Quantcast
Viewing latest article 6
Browse Latest Browse All 61

Answer by jamesflowerdew

This uses mouse or finger to generate an force called pPush, which is then applied to a ball. nFrame is Time.deltaTime all other vars with a "p" in front need declared at the top of your script. void FingerThing(float nFrame){ pGo=false; if(Input.GetKey(KeyCode.Mouse0)){ Vector2 vFinger = Input.mousePosition; Vector3 vPlace = this.camera.ScreenToWorldPoint (new Vector3 (vFinger.x,vFinger.y,100)); if(!pOldPress){ pTime=nFrame; pStartPos=vPlace; }else{ pTime+=nFrame; } pFirePos=vPlace; pOldPress=true; }else{ if(pOldPress){ pPush=(pFirePos-pStartPos)/pTime; pGo=true; } pOldPress=false; } }

Viewing latest article 6
Browse Latest Browse All 61

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>