This it the noob-ey-est question I’ve asked in a while… but how do I make a characterController move towards an angle? Like, say I have (0, 30, 0) as an angle, and I want the controller to move at that 30 degree angle… basically like I’m pointing it which way to go.
Are you asking how to set the orientation of the character controller, or how to move it in the direction it’s already facing?
If the former, here’s a few ways you can set the orientation (C#, not compiled or tested):
transform.eulerAngles = new Vector3(0f, 30f, 0f);
// Or:
transform.eulerAngles = Vector3.up * 30f;
// Or:
transform.rotation = Quaternion.Euler(Vector3.up * 30f);
// Etc.
If you’re asking how to move the character in the forward direction (presumably using one of the character controller component’s ‘move’ functions), you can use transform.forward (this will give you the current forward direction vector).
p_Velocity = Basic controls base. X is forward, Z is right.
This makes it so if I hold down w (forward) the player will always move to the place in front of his face. Not along the X axis.
You don’t need to write ‘transform.TransformDirection(Vector3.forward)’; you can just use ‘transform.forward’ (which is the same thing).
Thanks mang I’ll try this out