Hi , i want to set a character to move automatically forward (where it look) , how can i do this ?
thanks
You can achieve moving just forward based on the actual direction of the object.
Its actually quite simple. If you read a bit on the bullet questions or even just general moving questions you can find the answer within a reasonable amount of time.
So by adding a Character Controller (Hoping you have one already) you can do a basic movement script in JavaScript (Converting to C# is super easy.
Basic Character Controllers run off of speed so we need to define a set speed that we will have the target move at. So we set:
var speed: float= 3.0;
Now that we have the speed we need to get the direction and Character Controller to do the moving for us.
var con = GetComponent(CharacterController);
var dir = transform.TransformDirection(Vector3.forward);
Now that we have the speed, controller, and direction we just need to apply them. So we apply the speed by multiplying looking a bit like this:
dir.z *= speed;
and we apply all of this by using the character controller defined earlier and applying it on in the Move Function
con.Move(dir * Time.deltaTime);
put that all in your update function and you’re golden.