Select and move grid snapped obj problem

Blitz3D Forums/Blitz3D Programming/Select and move grid snapped obj problem

LamptonWorm(Posted 2008) [#1]
Hi all,

I hope someone can help me, been scratching my head and want to share the problem :)

Ok, what I'm trying to do is select and object (single click), once selected, mouse movement moves the obj around on its x/z axis but movement is snapped to a grid. This pretty much works.

When you select the object, I want the obj to stay still until you move the mouse to move it, however when in certain positions (because of the snap, I think) the obj 'jumps' initially, but not always.

The code below is set up so from the off you just point at the face of the white box nearest to the cam and click the mouse, and it shows what I mean, the object moves but I don't want it to. If you move around the obj to somewhere else and select it, sometimes it works fine (ie. doesn't move on first click).

I reckon I'm missing something obvious with the snapping! Ideas welcome :)

Ps. the code below is a cut down, thrown together to get the point across. The freelook function is from the forums, not my code but thanks to the author!



Cheers,
LW.


Charrua(Posted 2008) [#2]
hi

i was looking other thing in the code archives and see that

http://www.blitzbasic.com/codearcs/codearcs.php?code=1923

probably related to your ask
if not (i'm sorry)

Juan


LamptonWorm(Posted 2008) [#3]
Ah cool - thank you.

Cheers,
LW.