Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / 3d 'Sticky' grid

Author
Message
Pyro_guy
21
Years of Service
User Offline
Joined: 10th Oct 2003
Location: England
Posted: 22nd Dec 2004 22:48
Using this code, I can cause a 2d sprite to 'stick' to a grid (with tiles of 32*32 pixels)



However, when I try to transfer this into 3d, using the following code, the same does not occur.



How can I cause my 3d objects to 'stick' to a grid as the player moves the camera about freely?

Screw the rules...what can i blow up?
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 23rd Dec 2004 00:22
i think its because with the mouse it does it in segments, not pixels...not sure though

"Well, if he dies, it'll teach him not to do it again." - Me
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 23rd Dec 2004 05:46
camera position x() returns a 'float' whereas mousex() returns an integer.

So the trick is stick int() around camera position:

position object 1,int(camera position x())/10*10,0,int(camera position z())/10*10

Boo!

Login to post a reply

Server time is: 2024-11-27 16:58:44
Your offset time is: 2024-11-27 16:58:44