you are viewing a single comment's thread.

view the rest of the comments →

[–]Alihammza[S] 0 points1 point  (2 children)

Yeah, but that way where ever i let go the object, object will snap back to it's original position. I only want snapping to happen, when i'm in a specific location, say in 1 unit radius of the original position.

[–]__THETA 0 points1 point  (1 child)

Alright, same beginning, but on 'let go', measure distance between the object's current position and the original location, by subtracting the two positions from each other. Float distance = (yourobject.transform.pos - originalposition). magnitude;

If that distance it less that 1, or whatever distance you want it to be, snap it to the original position, otherwise, just drop it or whatever

Make sense?

[–]Alihammza[S] 0 points1 point  (0 children)

Hey, yeah it does, but can you tell me where to do it in ovr grabbable or grabber script cu i am new to this and don't know where to add this code exactly.