Transform.position vs rb.velocity

Hello there,

I have just quick question. What is better to use ?
I did challenge with rigidBody component and in video is ship controller did without ridigBody.
So what is better sollution or its does not matter what I use ?

My: this.rb.velocity = new Vector2(5f, 0f);
Video: transform.position += new Vector3(-speed * Time.deltaTime, 0, 0);

Thanks.

hi @Adrian_Orcik,

when you assign the velocity of a rigidbody youre generally setting it on its merry way once initially, and then letting the physics engine take care of its movement from there.

going the way of the video and updating the position each frame would mean that you are it charge of where the object is going to move to each frame.

Would really boil down to whether you want to fire and forget and let the physics engine take care of it, or if you need to update its next position manually each frame.

Hi @OboShape,

Okay thanks I understand :slight_smile:

Privacy & Terms