- Home /
Moving object with mouse on release
when I press a button for example : "A"( I need to continue presing it) it will create an object on the mouse position , after that the object will move when i move my mouse, simply it will bind with my mouse. when i release "A" button the object will continue to move on the last given direction(for example i was moving the mouse on 2x and 5y direction so it will continue on that direction with velocity of 10 ) until it collides [ also object or the mouse wont have any camera bound to them] I have no idea about how to do that , can someone help me out ?
As a starting point, play with the the DragRigidBody.js script that comes with Unity. I believe using the menu: Assets/ImportPackage/Scripts will bring the script into the scene. Attache the script to some object in the scene. Create some boxes and spheres and add Rigidbody components to each. This script will allow you to move and throw the objects.
Your answer
![](https://koobas.hobune.stream/wayback/20220613090651im_/https://answers.unity.com/themes/thub/images/avi.jpg)