- Home /
How to launch the player into the direction its facing - 3D
Hello, i was wondering on how i could launch the charactercontroller forward into the direction that it's facing. I'm new to coding, so sorry if this is a stupid question
Answer by Cassos · May 02, 2020 at 05:40 PM
You use transform.forward for that.
So if u want to let your player dash forward you use
public Rigidbody rb;
public float dashSpeed;
void Dash()
{
rb.AddForce(transform.forward * dashSpeed);
}
Hmm, is there any way to do this with the character controller?
You mean without an rigidbody?
I would always recommend to use the rigidbody with a custom movement script.
Especially when adding force to an object.
well.. i just copied a tutorial on how to make a 1st person movement, cause i have no idea how to do anything, so i dont know how to make it work with a rigidbody..
Your answer
Follow this Question
Related Questions
my character movement act weirdly when i activate my camera follow script 1 Answer
How can I make a player create holes in a 3D object through tracking the navmesh agent's movement? 0 Answers
How to tell if an object is moving in a circle? 2 Answers
Player Movement in unity3d 1 Answer
Problem with player movement 1 Answer