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

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

c# - How do I get the Nth largest element from a list with duplicates, using LINQ? -

jsp - "Sending a redirect is forbidden after the response has been committed" in sendRedirect -