- Home /
dupe: http://answers.unity3d.com/questions/136386/addforce-with-a-constant-velocity-not-overtime.html
AddForce to an object with static velocity
So, I have code that takes a hitPoint (Where a user clicks on the screen) and subtracts it from the players currentposition which, from what I understand from reading, will give me the direction the player should go in. So question #1, is it a direction? an angle? Once I do that, I normalize it which, again from reading I though it would make the object always move with a constance velocity towards its' destination. Question #2, does will normalizing a vector3 for rigibody.AddForce force the object at a constant velocity no matter the distance of the click from the player.
pHitPoint is the Vector3 parameter where the player click that is passed. transform.position is the gameObjects position that we want to add a force to (the player).
rigidbody.AddForce((pHitPoint - transform.position).normalized * (jumpForce * 2), ForceMode.Impulse);