- Home /
Question by
ConanQT · May 26 at 06:48 PM ·
movementrigidbody2dmomentum
Carry momentum from a move
I am making a move where the character dives, lands on his belly and can then do a roll jump forward to get back up. But when he lands on his belly I want him to slide a little with the momentum from the dive.
Currently, as he lands, all momentum stops. I don't know how to fix it. There is no particular reason that I use addForce for one of them and Transform.Position for the other.
void update () {
//dive
if (diveHappened)
{
transform.position += new Vector3(1, 0, 0) * Time.deltaTime * divespeed;
}
if (LieOnGround && Input.GetButtonDown("Jump"))
{
rb.AddForce(new Vector2(2, 2) * power, ForceMode2D.Impulse);
}
}
Comment
Your answer
Follow this Question
Related Questions
Issues with my 2D movement script & rigidbody2D 1 Answer
Rigidbody2D AddForce only working with large numbers 2 Answers
Moving Object in constant speed in one axis while be able to control the object in all axis 1 Answer
Can someone help me with this Rigidbody2D bug? 1 Answer
Why does this piece of code work with gravity and this one dosent 2 Answers