Different approach for player movement. Which one is better?

Hi everyone. So I did the challenge in this way:

PlayerMovement

So, I gave the ship a Rigidbody2D because we there told that moveable objects are not static, so they need one. I also changed Update to FixedUpdate, because my movement works with physics. I don’t have errors and everyone works just fine, but the shown way seems a lot more simpler. Is there a preferred/more efficient one between these two ways of implementing the movement? Also, are 2D Vectors okay (I could, of course, change it to 3D, but do I have to)?
Keep in mind, I am kind of new to all this. :slight_smile:

Thanks already for any help.

P.S.: How do I implement my code here in the discussions, so I don’t have to use an image of it?

Hi,

Also, are 2D Vectors okay (I could, of course, change it to 3D, but do I have to)?

A Vector2 is just a Vector3 without a Z attribute, so whilst you do need to have Vector3s in a 3D environment, you can use Vector2 if you are happy about the Z attribute being 0.

P.S.: How do I implement my code here in the discussions, so I don’t have to use an image of it?

Simply copy/paste your code into your reply and then add the simple code formatting (see below).

Hope this helps. :slight_smile:


See also;

Privacy & Terms