# Make players Rigibody move in direction its going?

I have my snowboard character which I am trying to fix the movement for. At the moment, The player is using transform.forward on the rigidbody to move forward. If my player turns around and faces up the hill, it keeps going no matter what. I need a way that my player goes in the direction that the gravity is pushing it, This will also mean my player can ride switch.

Also, My player is a capsule not a sphere so it doesnt roll around.

I have tried playing around with rigidbody.velocity but nothing seems to want to work.

if(Input.GetButton("Jump")){
transform.localPosition += transform.forward * Time.deltaTime * force; //force is the speed of the character
}

This is also Javascript ( yes I know i should use C# I'm learning it currently)

• Why does your code snippet involve the "jump" button? May 24 '19 at 1:15
• im using and xbox controller, when I hold A (Jump) it moves the player faster. May 24 '19 at 1:18
• Have you looked at past Q&A about snowboard character control in Unity? May 24 '19 at 1:22
• Yes, It just says I need clever raycasting and clever rotation management thats all I can get out of it. I have no idea how to approach such coding in the first place. May 24 '19 at 9:16