c# - Changing the speed of a gameobject -


i making object move continuously , code is:

myrenderer = gameobject.getcomponent<spriterenderer>(); speed_target = random.range (15, 20);  rigidbody.velocity = transform.right * speed_target; 

i have gameobject when clicked has reduce speed of moving object.

please tell me code has written in script in void onmousedown.

why can't use speed modifier variable in original speed equation increases or decreases target gameobject's speed? in mouse down event, change modifier necessary.

example: rigidbody.velocity = transform.right * speed_target * modifier;


Comments

Popular posts from this blog

rdbms - what exactly the undo information lives in oracle? -

bash - How do you programmatically add a bats test? -

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -