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 / arrow camera rotation

Author
Message
Jaded Gamer
18
Years of Service
User Offline
Joined: 19th Apr 2006
Location: Iceland
Posted: 31st Jul 2011 01:23
I have been reading, but camera positioning and movement seems to be beyond my level of comprehension. Can anyone please help me to understand.

I am trying to move in a first person rpg by using the keyboard arrow keys instead of the mouse. I can move forward and backward with the up and down arrows with no problem.

However I cannot figure out how to turn a set amount with the left and right arrow keys. I wanted to turn either using cspeed or at full 90 degree angles, but I can't figure out how to do either.



"So it goes."
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 31st Jul 2011 01:34 Edited at: 31st Jul 2011 01:34
Hi, here's some code I wrote a while back, it uses trigonometry to position the camera when using the left and right arrowkeys. Hope it helps and feel free to ask any questions.



chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 31st Jul 2011 02:02
New Hodgey update...I hope you don't mind Hodgey...in this new version, you can use keys W-S to look up and down.



cheers.

I'm not a grumpy grandpa
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 31st Jul 2011 02:12
Quote: "I hope you don't mind Hodgey"

Not at all, little code snippets like that are for anyone to use in anyway. Nice addition though Chafari

Jaded Gamer
18
Years of Service
User Offline
Joined: 19th Apr 2006
Location: Iceland
Posted: 31st Jul 2011 02:19
This is great, it does exactly what I wanted it to do, except its in 3rd person view. How do I do the same thing in 1st person?

"So it goes."
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 31st Jul 2011 02:35
Quote: "Nice addition though Chafari "
Thanks....I just try to help.

To convert this piece of code 3D person to first person just add the camera:
position camera object position x(1),object position y(1),object position z(1)


Have a look again to the code....I have rem the camera line and added a new line commands.



I'm not a grumpy grandpa
Jaded Gamer
18
Years of Service
User Offline
Joined: 19th Apr 2006
Location: Iceland
Posted: 31st Jul 2011 02:45
thank you very much, that is perfect!

"So it goes."
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 31st Jul 2011 03:45
Quote: "thank you very much, that is perfect!
"

You're welcome. Teamwork at its best, right Chafari?

chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 31st Jul 2011 04:39
Quote: "Teamwork at its best, right Chafari? "


Yes you are right...we can all learn from everyone

@Jader Gamer Enjoy it !!

Cheers.

I'm not a grumpy grandpa

Login to post a reply

Server time is: 2024-11-22 18:45:26
Your offset time is: 2024-11-22 18:45:26