Quantcast
Channel: Questions in topic: "addforce"
Viewing all articles
Browse latest Browse all 1264

AddForce in Character Controller problem

$
0
0
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().AddForce(thrust, ForceMode2D.Impulse); }

Viewing all articles
Browse latest Browse all 1264

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>