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 / anyone have a good smooth 3rd person camera code??

Author
Message
David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 25th Nov 2005 02:36 Edited at: 25th Nov 2005 03:07
ive been trying to code my camera to follow my player & stay behind it all the time.with no success! ive already looked through the search & havent found anything.


i want my camera to just follow my person smoothly & keep staying behind it,but when the camera gets to a certain angle,the camera stops rotating & staying behind the player!!!! why wont the camera keep facing the same direction the player is in?????????????? is this a bug??????

if so when will it be fixed???????????????????????





edit:

Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 25th Nov 2005 02:41
How the heck can we (or anyone else here for that matter) answer this question without seeing HOW you're doing it? There are loads of different ways to make the camera follow something, what's yours?

Please, think before posting, it'll save everyone time.

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
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 25th Nov 2005 03:19
sorry i was mad earlier also.but im frustrated about it not working as expected.
DB newbie
19
Years of Service
User Offline
Joined: 13th Nov 2005
Location: um..... i dont remember.
Posted: 25th Nov 2005 03:50
well did you go to the help menu on DarkBASIC classic/Pro and look at the camera commands and examples it gives you a whole lot of camera commands including some 3rd person commands hope that helped!

ATI mobility radeon X600 graphics card
AMD 64 Bit processor
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 25th Nov 2005 05:26 Edited at: 25th Nov 2005 05:27
Or did you even attempt at using the search button? I've submitted a function myself that should do exactly what you want, Im still tweaking it but it works as it is, along with tonnes of other snippets people have made.

PLEASE, use the search button!

David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 25th Nov 2005 06:17 Edited at: 25th Nov 2005 06:18
i did use the search. but i get tired of how the page has to constantly be refreshed.everytime i look at a search topic it brings up & want to go back,it says' the page has expired.this is annoying when u have to do this 50x.

anyway i came up with this code:


set camera to follow object position x(1),object position y(1),object position z(1),object angle y(1),4,15,50,0
rotate camera object angle x(1),object angle y(1),object angle z(1)
move camera 1*-0.7


its almost exactly what i wanted.thanks to the person who developed the code in the codebase,i got the tip for the move.

"move camera 1#-0.7 " ,this is what made the huge difference! im still not exactly sure how it works but it works.

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 25th Nov 2005 14:02
And we get tired of repeating ourselfs.

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 25th Nov 2005 14:06
Also, I'm sure that I've pointed you to my website for the tutorials for beginners before now.

In the Code Hints section there are code examples for three methods of 'Camera Follow' which would have told you what to do!

TDK_Man

David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 25th Nov 2005 15:08
"ive been trying to code my camera to follow my player & stay behind it all the time"

@ Tdk,i looked at your code at your site for set camera to follow & it does the same thing ive been talking about,the camera follows,but when u turn at a certain angle,it stops facing the same way as the player.
Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 25th Nov 2005 15:10
You have to set the angle of the camera to that of the object your following. Then it will always stay behind the playing and look in their direction.





TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 25th Nov 2005 20:30
Quote: "but when u turn at a certain angle,it stops facing the same way as the player."


Lol. Then figure out what it's doing and change it!

I don't understand the mentality of new programmers who want to paste code straight into their programs without understanding what it does. I read that as you basically saying "if the code doesn't do EXACTLY what I want to do, I'm not using it."

However, like Antidote says, the angle value in the Set Camera To Follow command states the angle the camera faces while following the object.

Pressing F1 gives you:

SET CAMERA TO FOLLOW X, Y, Z, Angle, Distance, Height, Smooth, Collision

...where 'Angle' means the "the coordinate to track". Normally this is set to the same angle as the object being followed.

You can play with offsets of the object's current angle to see what happens. For example:

X=Object Angle X(1)
Y=Object Angle Y(1)
Z=Object Angle Z(1)
SET CAMERA TO FOLLOW X, Y, Z, WrapValue(Object Angle Y(1)+90), 100, 30, 0

...will follow object 1 at the side, at a distance of 100 units and 30 units higher than the object. -90 will place the camera at the other side and +180 will place the camera in front of the object, moving backwards.

If you have a play with the command - changing the values - it soon makes sense.

TDK_Man

David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 26th Nov 2005 01:18
well thanks anyway.by no one helping me with this u guys forced me to work it out myself.& i finally came up with code that does what ive been trying to do.

later.

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 26th Nov 2005 01:23
Oh...so you...you actually programmed. Goodjob!

Jahya
19
Years of Service
User Offline
Joined: 23rd Nov 2005
Location:
Posted: 1st Dec 2005 18:50
Wow you guys are jerks. The major reason I hav'nt bought DBC or DBP is because the community is terribly biased. It takes 2 posts max to help this guy. Just post a damned link. No one learns without example. It's not like the documentation is good OR up to date.

Login to post a reply

Server time is: 2024-11-27 12:23:58
Your offset time is: 2024-11-27 12:23:58