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 / camera movement

Author
Message
Zipir
15
Years of Service
User Offline
Joined: 11th Aug 2009
Location: Turkey
Posted: 2nd May 2011 16:14 Edited at: 2nd May 2011 16:20
hello i have abit assistance

code is :

rotate camera ,camera angle x()+mousemovey(),camera angle y()+mousemovex,camera angle z()

if upkey() then move camera 0,1
if downley() then move camera 0,-1
if leftkey() then position camera camera position x()-1,camera position y(),camera position z()
if rightkey() then position camera camera position x()+1,camera position y(),camera position z()

when i have rotate camera with mouse then camera with left right keys(left and right movements) sides are not correct ... can any one help pls... tnx
Agent
20
Years of Service
User Offline
Joined: 7th Sep 2004
Location: Sydney, Australia
Posted: 3rd May 2011 07:02 Edited at: 3rd May 2011 07:04
Hi Zipir,

This could be a fairly complicated problem. Is there any reason you're not using MOVE CAMERA LEFT and MOVE CAMERA RIGHT?

If you want to calculate new coordinates, you'll need to use basic trigonometric math involving the camera's Y angle. To adjust the camera's X coordinate, you need to multiply the speed of camera movement by the sine of the camera's Y angle. To adjust the camera's Z coordinate, you need to multiply the camera movement speed by the cosine of the camera's Y angle. You'll need to adjust both coordinates when you move in any direction (up, down, left or right).

I can delve into this a little more thoroughly if you want, but see if you can take this information forward on your own first.

29 games
19
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 3rd May 2011 20:36 Edited at: 4th May 2011 20:19
I didn't even know there were MOVE CAMERA LEFT and MOVE CAMERA RIGHT commands and I've only just spotted the same for the objects. I guess this is what you get for going from DBC to DBPro, you just stick with what you know.

Anyway, in the vain of sticking with what I know, this is the method I use, essentially taken from the old monster hunt tutorial.

The below demo is essentially classic FPS controls, which is what I assume you're after.


EDIT: forgot to put this in a code box



As you can see, there is no trigonometry at all, just the use of the NEWXVALUE() and NEWZVALUE() commands.

Hope this helps.
Zipir
15
Years of Service
User Offline
Joined: 11th Aug 2009
Location: Turkey
Posted: 4th May 2011 19:37
tnx...this will be very usefull
29 games
19
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 4th May 2011 20:19
Glad to help

Login to post a reply

Server time is: 2024-11-24 04:27:47
Your offset time is: 2024-11-24 04:27:47