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 / Third Person View

Author
Message
Dead_Zone
19
Years of Service
User Offline
Joined: 6th Jul 2005
Location:
Posted: 21st Oct 2005 10:22
i cant get anything to work i need an example on how to make the camera look behind a model and follow it when the upkey is pressed anyone please help
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 21st Oct 2005 15:30 Edited at: 21st Oct 2005 15:33
Ok really there is no excuse for this. This is just pure lazyness, there's a post about this EXACT topic like 4 posts down, if you cant find that then its your problem, not only that but if you used the search button you'd find even more posts about this topic.

Show some initiative.

<EDIT>

I'm such a nice guy, here's the link:

http://forum.thegamecreators.com/?m=forum_view&t=62991&b=7

Freddy 007
19
Years of Service
User Offline
Joined: 30th Nov 2004
Location: Denmark
Posted: 21st Oct 2005 15:37 Edited at: 21st Oct 2005 15:38
Here. I made a simple snippet. I've commented it, so you should understand. I hope you know of functions.



Dead_Zone
19
Years of Service
User Offline
Joined: 6th Jul 2005
Location:
Posted: 22nd Oct 2005 03:19
excuse me RUCCUS bit before i posted this topic i used the search funtion so why dont you take some Initiative and stop assuming what you dont know thank you!
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 22nd Oct 2005 06:23
KLU 007

Doesn't pressing W and S in your example do the same thing?

TDK_Man

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 23rd Oct 2005 02:50 Edited at: 23rd Oct 2005 02:53
...If you used the search button, you would've found the answere. I just used the search button and found the exact thread I was talking about that has what youre talking about. Just because you used the search button doesnt mean you used it right.

Anyways I was in a bad mood I'm not usually like that, either way the post WAS right below yours. And you would've found it with the search button.

If you still haven't found the post in the thread containing the code it was this:

Quote: "3rd Person View w/ Rotating and Zooming Snippet
DBP - May work in DBC aswell

+ Code Snippet
`3rd Person View w/ Zooming
`Created by RUCCUS, Thursday October 20th, 2005

`For help contact me at ruccus@ruccus.net or add
`Ask-RUCCUS@hotmail.com and I'll help you on MSN if I can.

SYNC ON:SYNC RATE 0:AUTOCAM OFF:HIDE MOUSE

MAKE OBJECT BOX 1,30,100,10

MAKE OBJECT TRIANGLE 2,0,0,0,0,0,0,0,0,0

MAKE MESH FROM OBJECT 1,2

ADD LIMB 2,1,1
OFFSET LIMB 2,1,0,200,-500
HIDE LIMB 2,1

MAKE OBJECT CUBE 3,200
POSITION OBJECT 3,0,0,300

OFFSET#=-500

DO

INC OFFSET#,MOUSEMOVEZ()
IF OFFSET#<-500 THEN OFFSET#=-500
IF OFFSET#>-100 THEN OFFSET#=-100
OFFSET LIMB 2,1,0,200,OFFSET#

X#=OBJECT POSITION X(1)
Y#=OBJECT POSITION Y(1)
Z#=OBJECT POSITION Z(1)

POSITION OBJECT 2,X#,Y#,Z#
POSITION CAMERA LIMB POSITION X(2,1),LIMB POSITION Y(2,1),LIMB POSITION Z(2,1)
POINT CAMERA X#,Y#,Z#

IF KEYSTATE(17)=1 THEN MOVE OBJECT 1,1
IF KEYSTATE(31)=1 THEN MOVE OBJECT 1,-1
IF KEYSTATE(30)=1 THEN MOVE OBJECT LEFT 1,1
IF KEYSTATE(32)=1 THEN MOVE OBJECT RIGHT 1,1

CAMY#=CAMY#+MOUSEMOVEX()*.1
CAMX#=CAMX#+MOUSEMOVEY()*.1
IF CAMX#>90 AND CAMX#<135 THEN CAMX#=90
IF CAMX#>270 AND CAMX#<225 THEN CAMX#=90
YROTATE OBJECT 1,CAMY#
YROTATE OBJECT 2,CAMY#
XROTATE OBJECT 2,CAMX#

SYNC
LOOP


Breakdown:

Object 2 is a dummy object, it has a limb offset at the starting position you want the camera at. Every loop the camera is positioned at this limb's coordinates and pointed to object 1. Also, every limb the dummy object 2 is positioned at object 1's coordinates, now the camera will follow the user as they move.

Next we use the basic mouse looking code used in a lot of FPSs nowadays on DBP, and alter it a bit. We only rotate object 1 on the y axis and not the x axis so the user can't fly around, and then we rotate object 2 on yhe y and x axis so the user can look in all directions as the mouse moves.

Finally, we offset the limb from object 2 on the z axis by OFFSET#, OFFSET# changes depending on MOUSEMOVEZ(), so as the user scrolls the limb offsets closer and further away from the object, causing the camera to go with it, giving a zooming ability. There's limits invluced aswell, if OFFSET is less than -500 then it stops zooming out, and if it's greater than -100 then it stops zooming in. Alter the limits and the amountt he camera zooms in, aswell as what axis are changed for different effects. It might be a good idea to alter the Y offset of the limb aswell.

Controls:

- WSAD movement
- Move Mouse to look around
- Use scroll button to zoom in/out

Hope it helps, goodluck."


Non hard feelings.

Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 27th Oct 2005 04:28
Quote: "excuse me RUCCUS bit before i posted this topic i used the search funtion so why dont you take some Initiative and stop assuming what you dont know thank you!"


Take the initiative... and... stop... assuming... That makes no sense at all.

But seriously you shouldn't post things like this. We see this kind of thing all the time so you think we would get used to having 500 of the same topic but it really just makes us kind of mad. Then replying with smarmy remarks doesn't help. Try taking some initiative on your own part and taking 5 to 10 minutes at least to try some different words to find what your looking for.

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada

Login to post a reply

Server time is: 2024-09-24 07:34:49
Your offset time is: 2024-09-24 07:34:49