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

Rigidbody2D.velocity.x not working but Y does

$
0
0
This code is suposed to add a force on the X axis every time I press SHIFT, but it just doesn't work, and if I try Vector2.up instead of Vector2.right it works, I don't understand why this is happening, but the velocity on the X axis is not working properly, can someone explain? void Update() { if (Input.GetButton("Fire3")) { rb.AddForce(Vector2.right * force * Mathf.Sign(transform.localScale.x), 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>