Hi,
I’m new to unity but have has some experience with game programming before.
Today i noticed Unity’s physics engine won’t allow interception from script. What i mean is that
when i set a rigidbody’s velocity to zero, i can still see the objects moving slowly.
I suspect this is due to the physics engine will integrate gravity and add this to velocity of the rigidbody.
But weird thing is when I set velocity in all the update functions, it still move.
And this contradicts the documentation about the execution order of unity. Unless the physics simulation actually translates the objects too.
Anyway so my issue is basically not sure how to aquire total control of object motion, so if i want to implement my custom friction model to my objects, i can be sure no other hidden forces will move my objects
Code i used for test:
public class UpdateTest : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
rigidbody2D.velocity = Vector2.zero;
}
void FixedUpdate() {
rigidbody2D.velocity = Vector2.zero;
}
void LateUpdate()
{
rigidbody2D.velocity = Vector2.zero;
}
}