- Home /
Question by
deny250 · Jan 16, 2021 at 05:23 AM ·
rigidbody2dknockback
how do i add a force towards a position with a rigidbody2D?
how do I add a force towards a position with a rigidbody2D like when you shoot a bazooka then you get a bit of a knockback how do I do that
Comment
Best Answer
Answer by CmdrZin · Jan 16, 2021 at 05:31 AM
assuming you do something like
shell.AddForce(transform.forward * thrust);
to shoot the bazooka shell, use
shooter.AddForce( -transform.forward * thrust/10);
to apply a knockback force to the shooter. A little less force in the opposite direction.
Your answer