Question by
Orzel94 · Mar 12, 2016 at 12:48 PM ·
movementcharactercontrolleraddforce
AddForce in Character Controller problem
Hi!
I've got a problem with function AddForce. When sth get into trigger of my character (eg. enemy) I want my character to Jump back (eg. with Vector2(5,5)) but when it happen my character jumps only UP, on X axis there is no move. The problem doesn't exist when I want to do the same on other object (for example simple sprite with rigidbody2D, some collider2D, and Collider2D as trigger) there is some screenshots how my object looks like and function I use
http://zapodaj.net/5f592f1de1c71.png.html
http://zapodaj.net/a0e84c8cd7c03.png.html
public Vector2 thrust;
void OnTriggerEnter2D(Collider2D other)
{
GetComponent<Rigidbody2D>().AddForce(thrust, ForceMode2D.Impulse);
}
Comment