Timeline for Restricting body movement withing a specific length while dragging a gameobject in unity
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 24, 2015 at 11:46 | comment | added | Hash Buoy | By setup i didn't mean the screen shot of the inspector for the pendulum . I meant how the objects are placed in the scene that is what i need to see so that i can get it solved . Else it will be all guess work from my side . You need to share a new project with a scene containing the whole pendulum setup. You can remove all your personal scripts and just keep the code which handles the drag for the pendulum. | |
Aug 24, 2015 at 11:11 | comment | added | Javasamurai | See the updated question. | |
Aug 24, 2015 at 8:21 | comment | added | Hash Buoy | Sorry mate I am not expert enough to debug this logic , until I see the setup. | |
Aug 24, 2015 at 8:10 | comment | added | Javasamurai |
This is the improved code,the pendulum is now restricted to y axis but no luck in the z axis. transform.position = new Vector3 (cur_pos.x,Mathf.Clamp (cur_pos.y,transform.position.y, pendulum_body.hingeJoint.connectedAnchor.y),Mathf.Clamp (cur_pos.z,-pendulum_object.transform.position.y,pendulum_object.transform.position.y));
|
|
Aug 22, 2015 at 8:49 | comment | added | Hash Buoy | I have tested the code , I have used it once for on screen game pad to control the thumb from moving outside the surrounding circle. I am sure there must be some physics or hierarchy issue messing around. If you can share a project with the pendulum setup. I might be able to fix it. | |
Aug 22, 2015 at 7:27 | comment | added | Javasamurai | Thank you for the respose,but that code didn't work.The pendulum now behave abnormally.I forgot to tell that the pendulum is swinging in y and z direction only.x axis position didn't change. | |
Aug 21, 2015 at 10:47 | history | answered | Hash Buoy | CC BY-SA 3.0 |