- Home /
What is transform.forward?
I am working with a project getting help from a tutorial where he used transform.forward function.He didn't explain this function.So I need help.
Answer by UnityCoach · Apr 16, 2017 at 07:03 PM
transform.Forward is a Vector3 that tells you where the object is pointing at.
You know the blue movement arrow in the scene view? You can think of transform.forward as the direction of that arrow.
Answer by Cuttlas-U · Apr 16, 2017 at 07:17 PM
hi; for example when u want to give force to move to an object u have to mention which direction this force should be applied and forward is one of them;
we have these Directions: forward , Right , left , up , down
u can multiply any of these direction like this :
GetComponent<RigidBody>().AddForce(Vector3.Forward * 10 ) ;
I get your point here, though Vector3.Forward isn't the same thing as Transform.Forward, unless the object is facing Z+ direction, off course..
Vector3.Forward, Vector3.Right, etc. are simply shorthands for (0, 0, 1), (1, 0, 0), etc.. While Transform.Forward returns the orientation of the Z+ axis as a Vector3.
Then what is the difference between transform.forward and vector3.forward? I am really not being able to understand that.Help me please.It Will be helpful if you give any example.
Vector3.forward is the forward facing direction of the world. It remains constant for every object in the scene, however they are rotated.
transform.forward is the forward facing direction of an individual object.
Answer by DamonJager · Nov 09, 2017 at 04:46 AM
I think that setting it triggers another function like orthonormalization. But I can be wrong. I'm also interested in this.