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 / [DBPro] 3rd Person Program: Rotating object with Mouse<

Author
Message
Xender
18
Years of Service
User Offline
Joined: 28th Apr 2006
Location:
Posted: 13th May 2006 01:04
Like the subject line demonstrates, what i am trying to do is this: I have a cube, object number=hero , and i have him moving forward, back, left and right, with arrow keys (later will be WASD) and what i want to have happen is that hwen you move the mouse, left and right and up and down, the object rotates to face that direction, and well then also move in that direction its facing (thats for left and right). and for hte up and down, i am trying to figure out how to make a crossair, and hwen i look up and down left and right, it not only rotates the object left and right, but also moves the crossair that way too, and moves crossair up and down.. any help would be very appreciated thanks so much
D Ogre
21
Years of Service
User Offline
Joined: 19th Nov 2003
Location:
Posted: 18th May 2006 04:25
You could use the mousex() and mousey() functions to grab the current mouse position. Then you could use point object and point camera to move in that direction. The Z position for those cammands will have to be determined by you. This could be the z position of another object in the background or it could be a constant.

The crossair could be handled in a simular fashion. Maybe if you post some code, someone could give you some more help with it.
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 18th May 2006 04:55
Xender im going to let you in on a big secret. Only a small amount of forum users know about this (apparantly). There is, on this forum right here, an "elite" artificial intelligence system, that will answer any question you have. Its located at the bottom of every board, you just enter your phrase/query in the search box, hit search, and boom, instantly useless repeated questions that have been answered millions of times before, just like this one, will appear right before your eyes, with user commentaries, code snippets, and even wise cracks!

In other words, USE THE FREAKIN SEARCH TOOL!

achem.

Xender
18
Years of Service
User Offline
Joined: 28th Apr 2006
Location:
Posted: 18th May 2006 18:10 Edited at: 18th May 2006 18:59
k next time ill post that i allready used the search and couldnt find something that really helped to explain how to have the mouse change the angle of the object, must be that useless oh and here is all my code ..

u can so that everyone has that code, and its simple, which may be why i posted this question..
i got some variables from curved basic site... i wonnder where i got the rest?
ill keep trying to figure out how to get the mouse to change object angle...
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 18th May 2006 23:49
ok so here goes..........
this bit i changed to allow sidestepping instead of using the left\right arrowkeys to rotate (as this is done by mouse now)


this bit is the code u wanted (i.e. rotating using mouse and crosshair)


and the full code is here


good luck with the game

life's one big game
spec= 2.6ghz, 1gb ram, 512mb gpu, directx 9.0c, dbpro and classic
Xender
18
Years of Service
User Offline
Joined: 28th Apr 2006
Location:
Posted: 19th May 2006 04:46
thanks a bunch smallg, hopefully my game will be *cough*ok*cough* just basicaly run around and do someting to the bad guys to kill them, and get some nice powerups for faster pseed and stuff, i at work now but tomorow i will take a look at the code and see if i get it and if not ill just search the forums again, ok thanks so much ttyl
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 19th May 2006 05:16
Simply just change the angle using the mouse speed...



RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 19th May 2006 05:22
Im glad you got an answer but I doubt you actually did a search, as within 10 seconds of searching the phrases "3rd", "camera", and "mouse" I've gotten numerous answers (including 2 large explanations I gave myself) from the newcommer's corner and the DB/P Chat boards. If you just search "help with 3rd person camera", ofcourse you wont get anything.

Login to post a reply

Server time is: 2024-11-27 19:50:04
Your offset time is: 2024-11-27 19:50:04