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 / fps camera position

Author
Message
paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 11th Feb 2009 19:22
Hi,could you tell me the way to position the camera to fps position please.
My camera position code is below,I would like for the camera to change from 3rd person to 1st person and I would also like for the camera to follow the player in 3rd person position.
Many thanks.


[code
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 11th Feb 2009 20:42 Edited at: 11th Feb 2009 20:44
position the camera at the players co'ords and point it in the direction the player is facing

You may need to correct the y position a little, depending on how talk the player is.

And maybe hide the player object.

Hope that helps

Without Music or Love the world would be a very empty place... Thank god I still have music.. --'-<@
paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 12th Feb 2009 09:30
Many thanks,but am a little unsure how to do that,if the player co-ords are:
position object 1, x#, 0, z#
xrotate object 1,90

position camera x#, 0 to 10, z#,seems to be ok but unsure how to rotate the camera when the object rotates.
I tried if object 1 rotate then rotate camera but it fails to run.
A little more help please with rotating the camera with the object.
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 12th Feb 2009 11:35
Its fairly simple trigonometry dude, Here an example for you to mull over



I hope this makes sense

Without Music or Love the world would be a very empty place... Thank god I still have music.. --'-<@
paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 12th Feb 2009 13:13 Edited at: 12th Feb 2009 14:02
Many thanks dude,I now have the camera following in 3rd person,but the camera position in 1st person stays in the same spot with position camera x,y,z or 0,5,0,which I cant quite get it to keep with the player after he has moved,could you update the code please for it to keep in sync when the player moves.

position camera object position x()object position y()object position z().

point camera 50*cos(angle#),5,50*sin(angle#)
This is as close as I can get to the right code and im not sure about pointing the camera to keep facing forwards also.


EDIT
Yrotate camera works but the camera is facing backwards,I used xrotate camera 180 which faces the camera forwards but its upside down,how do I flip the camera over or get the camera facing forwards without xrotate camera.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Feb 2009 15:06 Edited at: 12th Feb 2009 15:06
What is this?
Get your program written by other people in episodes?

I don't believe that I've seen any code written solely by you in any of your posts. I suggest that you read the tutorial links and the help files and learn to code, and stop asking people to write it all for you.

paulhenry
16
Years of Service
User Offline
Joined: 20th Jun 2008
Location:
Posted: 12th Feb 2009 15:59
Many thx for your kind comments,if you check the code Id say less than 10% is from help from this forum,90% + is from tutorials etc,I thought the whole point of having a forum was to ask if you dont know,otherwise what is the point in having this forum.





[/code]
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 12th Feb 2009 18:14
You need to take the object position (x and z) into account when pointing the camera. Good luck

Without Music or Love the world would be a very empty place... Thank god I still have music.. --'-<@

Login to post a reply

Server time is: 2024-11-24 12:33:03
Your offset time is: 2024-11-24 12:33:03