- Home /
Rigidbody2D.Velocity = Vector2 not changing X Position
I'm making a fighting game and I trying to apply a knockback when receiving a hit
This is the problem:
private void OnTriggerEnter2D(Collider2D Coli)
{
rigidez.velocity = new Vector2(30.0f, 18.0f);
print(Coli.name + " " + rigidez.velocity.x);
}
When I run this, it seems to work fine in everything but the force in the X axis, it's launching upwards and the print says 30 at the rigidez.velocity.x part, but the X position of the object is not changing. And yes, the freeze position isn't checked.
Answer by SilverFox13 · Jun 28, 2018 at 08:12 PM
I tried it and it worked perfectly for me, it must be some small mistake, try taking a look at everything again i guess
Your answer
Follow this Question
Related Questions
,Rotate a gameobject around another while being attracted by its gravity 1 Answer
Player is not moving 0 Answers
Object jitters when the scene starts 0 Answers
Rigidbody2D giving incorrect value 1 Answer
slide and dash 2D 0 Answers