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.

Bug Reports / camera wont keep facing same direction as player!

Author
Message
David iz cool
18
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 25th Nov 2005 02:39
im trying to code a 3rd person camera:

heres my code:



the camera follows & rotates with the player until i turn a certain angle,then the camera stops rotating with the player!!!

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 25th Nov 2005 03:05 Edited at: 25th Nov 2005 03:10
This is no bug. It is behaving exactly like you have it programmed.

[edit] Try something like adding a limb to keep up with your camera's position in relation to the object's, instead of just offsetting on each axis without taking into consideration the rotation of the object.



Richard Davey
Retired Moderator
21
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 25th Nov 2005 03:07
Rejected - take this back to the Newcomers/DB board, and try following the advice I gave you there re: posting some working code people can point to and say "change this bit".

Fat kids always win at see-saw.

The world is full of idiots. But an unusually high percentage seem to appear on my TV screen.
David iz cool
18
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 25th Nov 2005 03:17 Edited at: 25th Nov 2005 03:17
thanks for the help,but i already know how to keep the camera with the player.my problem is im trying to get the camera to follow the player & keep facing the direction the player is going all the time.i posted my code over here:

http://forum.thegamecreators.com/?m=forum_view&t=65683&b=7
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 25th Nov 2005 03:22
I would still stick with limbs. My code works ... yours does not. The reason yours isn't working is that your code is not positiong the camera exactly 10 units directly behind and above the object. As your rotation change your camera is not moving. My code uses an offset limb to maove the camera even when the object isn't moving and is only rotating. This puts the camera exaclty 10 units behind the object and 10 above no matter which direction the object is facing. This is why your is not working. The camera and objects are the same angle, the cameras position in relation to the object's is just not being updated properly.

David iz cool
18
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 25th Nov 2005 03:34
thanks.im actually trying to modify your code.it works but i dont want rotation using the mouse,im trying to get the camera to update rotation with only arrow keys. so i move my player & the camera just truely follows behind the player. my ultimate goal is to have the camera follow and also point toward the player.
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 25th Nov 2005 04:39 Edited at: 25th Nov 2005 04:42
The only part of my code you need to work with whatever you have for roatation and movement is this for the main player setup (use your model in place of make object cube)



or this for a player object with more than 1 limb already


and this right before the sync in your loop



or



David iz cool
18
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 25th Nov 2005 05:12 Edited at: 25th Nov 2005 06:11
i found this code in the codebase:



only difference between this code & yours is when i add the point camera command to point the camera toward my player with your code,when dbp compiles the game i get a crash message,then dbp runs the game...???
so i will probablly have to go with the code i found in the codebase.but thankyou very much for your help lost in thought!!!

the only thing i need to figure out now is how to make the camera move more smoothly ,not so rigid with the player.(but ill figure it out somehow...someday :p )

thanks!




edit:

alright!! i came up with this code:


its almost exactly what i wanted! thanks to everyone that helped!
David iz cool
18
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 26th Nov 2005 14:24
here is some code that demonstrates exactly what im talking about.

the camera follows until you get to a certain angle then it does not follow anymore.

spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 27th Nov 2005 00:45
You can't use the 'free rotate' commands to move your object when using set camera to follow, because of euler angles oddities when you get to certain angles. You need to use standard rotate commands.

So replace youe turn object command with;

yrotate object 1,wrapvalue(object angle y(1)+0.1)

and all is well.

Understanding the way DBPro deals with euler angles takes a bit of getting used to - took me a LONG time.

Boo!
David iz cool
18
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 28th Nov 2005 06:55
thank you soo much spooky!!!

this is twice now youve helped me with something difficult that i couldnt figure out in dbp!

i rreeeeaaally appreciate your help!!!

thankyou!!

your friend David

Login to post a reply

Server time is: 2024-04-20 00:07:19
Your offset time is: 2024-04-20 00:07:19