Quantcast
Viewing all articles
Browse latest Browse all 194

2D rope attached object has no momentum when swung

Hi guys, I'm currently trying to make a ball that is attached to a rope (made from 2d hinge joints) keep it's momentum when swung. The rope follows my mouse and when i move it around, i want the ball to have momentum so that i can swing it around like a wrecking ball or a yoyo. Currently the ball doesn't have any velocity or momentum when i swing the rope around. ![alt text][1] [1]: /storage/temp/118023-game.png This is my mouse follow code : private Vector3 mousePosition; public float moveSpeed = 0.1f; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (Input.GetMouseButton(1)) { mousePosition = Input.mousePosition; mousePosition = Camera.main.ScreenToWorldPoint(mousePosition); transform.position = Vector2.Lerp(transform.position, mousePosition, moveSpeed); } } } Thanks for any help!

Viewing all articles
Browse latest Browse all 194

Trending Articles



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