I am using the DragObject script from the Wiki:
http://www.unifycommunity.com/wiki/index.php?title=DragObject
Say you have a box you want to move, if you click on a corner of the box the the whole box will snap so that its anchor/pivot (center) is where the mouse is. I want to modify it so that if you click on any corner and drag no snapping will occur.
Is this the same as the script that’s bundled in the ‘Standard Assets’ package?
No. This is a different one. You find the code and a working web player in the link I provided. It is working fine and I am using it in the project already. Its just that I really need to solve this snap to center issue to make it usable in my case.
Please, somebody help me with this.
Have you set the “Freeze Rotation On Drag:” option.
This will prevent it from rotating while being moved… Otherwise standard physics applies
The “SNAP” effect is caused by this line
var move = cam.ScreenToWorldPoint(Vector3(mousePos.x, mousePos.y, camTransform.position.y - myTransform.position.y)) - myTransform.position;
As it moves the selected transform to the x,y of the mouse. (The transform is usually located in the center of an object).
Hi Psyclone,
“Freeze Rotation on Drag” is ticked.
Regarding the snap effect. Is there a way to offset it somehow so that it won’t occur?
So why are you using this one instead?
(Just wondering what the differences are, as I’ve not had a chance to see it running.)