- Home /
jump and backflip(rotate) like in altos adventure
Like in altos adventure I want to move my player right side automatically so i did using velocity in direction of player. My player Align to curved surface using raycast by finding normal and rotating to that angle. I want to add jump to my player with running velocity how to approach it? And if player holds button it will rotate(backflip) the amount you hold button if you remove you remove held button after rotating half it will align to curved surface slowly. adding force and velocity in upward direction of player is not working properly to curved surfaces.
void FixedUpdate()
{
speed = temp.velocity.magnitude;
//angularspeed = temp.angularVelocity.magnitude;
if (Input.GetKeyDown(KeyCode.D))
{
started = true;
}
if (started == true)
{
temp.velocity = transform.right * 10;
// temp.AddForce(Vector2.right * 5);
}
if (Input.GetKeyDown(KeyCode.Space))
{
//temp.velocity = transform.up * 10;
temp.AddForce(transform.up * 10, ForceMode2D.Impulse);
//temp.AddTorque(10);
}
}
Comment
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
AddTorque in 2D doesn't work? 0 Answers
Rotate a 2D Rigidbody to a desired angle using AddTorque? 3 Answers
Distribute terrain in zones 3 Answers