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 / Right Mouse Button

Author
Message
Programmer of Power
19
Years of Service
User Offline
Joined: 22nd Aug 2005
Location: Home
Posted: 14th Feb 2006 03:36
I'm making a classic arcade game. But I want to inlude a couple twists. One of the things I want to be able to do, since it's 3d, is rotate around the playing field when holding the right mouse button.

So first off, I don't know how to detect if there is a right mouse buttone being pressed.

Second I don't know how to rotate around the field. I know it has something to do with camera work, but that's obvious.

"I will work harder... if you ask me enough times."
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 14th Feb 2006 04:32
IF MOUSECLICK()=1 returns true if the left mouse button is clicked, IF MOUSECLICK()=2 returns true if the right moust button is clicked.

Not going to get into any code here, there's a lot of ways to do waht you want but one of the simplest would be to create a "dummy" object, add a limb to that object, offset it on the z and y axis to the distance and height you want the camera, position the camera at the limb's position, point the camera to wherever, then rotate the dummy object left when the right mouse button is clicked, and vise versa when the left mouse button is clicked.

Just a note usually when creating "dummy" objects (by this I mean just any object that wont be seen by the user, usually the user won't even know its there), you should make them triangles with dimensions 0,0,0,0,0,0,0,0,0 and then proceed to hide them for the smallest amount of lag possible.

There's been a lot of questions on rotating the camera around a point, some searches would bring up a lot of examples, I think I even made a commented-snippet to someones question on the topic, just glance around in the search and you'll find an example somwhere.

Goodluck,
- RUC'

Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 14th Feb 2006 12:00
Another way to rotate around an point, at last arond a object, is the SET CAMERA TO FOLLOW command. Thew manupulating the values of the command, and in combination with POINT CAMERA, its possible to create a camera that rotates around an object. Dont know if its more effective then the way RUCCUS suggested (personaly I think its not that good, but still, its a way). Goodluck.

Login to post a reply

Server time is: 2024-11-27 06:49:33
Your offset time is: 2024-11-27 06:49:33