Hi there guys, sorry for the basic question but
Can someone please help me when should I use Vector3 and when can I just use transform.Translate? any advice or links are most welcome, thanks.
Hi there guys, sorry for the basic question but
Can someone please help me when should I use Vector3 and when can I just use transform.Translate? any advice or links are most welcome, thanks.
Well, you should use Vector3 when a function require it, or it is easier to work with.
You don’t store a position in three float ; you use a Vector3.
About Translate, well, you can use it to translate something, but avoid using it to move a CharacterController (use rather function Move), or a Rigidbody (use rather AddForce).
If the question is actually about transform.position vs. transform.Translate (since a Vector3 is used for both), the former is absolute positioning and the latter is relative. Use whatever is more easier/appropriate for what you’re doing, since they amount to the same thing in the end.
–Eric
Thanks guys.
The reason why I’m confuced is when I say transform.translate and open a bracket, it already gives me the option to inssert some x,y and z values. why would I use vector3 then. Just struggling to wrap my head around this… :?:
You use Vector 3 if you want to move in x,y and z directions
If you just want to move forward you can use Transform.Forward or Transform.Translate.z
There may be slight discrepancies in my type, hopefully this is correct the important thing is, Vector 3 gives all 3 axis to move in