I have the cube,and able to rotate using transform.Rotate(x,y,z),?
hw to i move at the same time? what is the differ between transform.forward and transform.translate?
which i am gng to use?
transform.forward is a direction, a Vector3
transform.translate(…) is a function that moves the transform.
you use them together
var speed : float = 10;
transform.translate(transform.forward * speed * Time.deltatime);
“translate the position of this transform along it’s forward direction by speed by the time taken in this frame” if this is placed in the Update() function it will be called every frame.
have a look at these unity script reference pages:
1 Like