- Home /
Question by
13yearoldceo · Aug 08, 2015 at 04:42 PM ·
rigidbody2daddforcedamagerigidbody.addforcepushback
rigidbody2d.addforce for is not working for the x axis
i made it that when my character gets hurt or hit by an enemy it gets pushed by a pushback force caused by the damage by using addforce. The only problem is that the addforce only works for the y axis not the x even though its supposed to work for both, hears the code.
if (pushback) {
GetComponent<Rigidbody2D>().AddForce( new Vector2(pushbackforcex,pushbackforcey),ForceMode2D.Impulse);
pushback = false;
}
Comment