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 / 3rd person camera HELP!!!

Author
Message
ssj3_shadow
21
Years of Service
User Offline
Joined: 12th Jan 2003
Location:
Posted: 8th Sep 2003 12:54
ok im having trouble limiting the camera angle (see code provided)
ive tried numerous tests but they all produced a choppy result (not actually disallowing camera movement, just repositioning it).
so read the comment in the code and i u think u can help please do

thanks,
ssj3_shadow

w00t -what does it mean?
ssj3_shadow
21
Years of Service
User Offline
Joined: 12th Jan 2003
Location:
Posted: 8th Sep 2003 16:54
come people i gave u the code any cind of help will be appreciated

w00t -what does it mean?
Archaikz
21
Years of Service
User Offline
Joined: 11th Apr 2003
Location:
Posted: 8th Sep 2003 23:48
Well im still new to but just a question but why are you setting the camera to follow object 1's positions then pointing the camera to object 1's positions..your basically doing the same thing twice. about the limiting could you just use a if statement saying
if angle = 320 then angle = 320 or something. Im still new so you may want more experienced people to help.
Symon
21
Years of Service
User Offline
Joined: 29th Aug 2003
Location:
Posted: 9th Sep 2003 01:29
angle keeps changing

if angle=>270 and angle=<359 then angle=270
then move the object by angle
this might confuse u more
ssj3_shadow
21
Years of Service
User Offline
Joined: 12th Jan 2003
Location:
Posted: 9th Sep 2003 03:03
Quote: "setting the camera to follow object 1's positions then pointing the camera to object 1's positions..your basically doing the same thing twice"


not really Archaikz true i have the camera following the object but if u dont point the camera at the object it could be pointing at anything in the 3d space, pointing the camera at the object allows the user to see what the camera is following...

???Symon - what i really need is a sample of some mouse look code so i can see how the camera angle is limited, and apply the same test to my code..in theory this should work.

so more help please people.

w00t -what does it mean?
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 9th Sep 2003 06:50
I know a lot about this stuff.

First of all, use the sync commands. Place "sync on" at the beginning of your code. Also, put "sync rate 60". This will limit your program to 60 fps. Use whatever value you want. Using the sync commands will allow your program to run faster, and updates the screen only when you want to. This prevents the user from seeing the camera correct itself. Make sure to place the word "sync" right before your "loop" command. This way it will refresh the screen once per loop instead of every time something happens.

I re-wrote your code for you. I hope you appreciate it. Everything works now, press the two mouse buttons to move forward or backward. The Object now rotates correctly, and you can look with the mouse. I limited the up and down angle to +-30 but you can change it. I didn't even use the set camera to follow stuff. I don't like it. I hope you can understand it.

Good Luck, Xander

Xander - Bolt Software

"Make your words soft and tender, you may have to eat them tomorrow" -Anonymous
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 9th Sep 2003 12:33
Quote: "why are you setting the camera to follow object 1's positions then pointing the camera to object 1's positions..your basically doing the same thing twice."


Not true. They do completely different jobs. This is a good thing, honest! You can create some fantastic camera effects by following objects and panning around other objects in the scene. Combining these 2 commands is fantastic for creating cut-scene action.

Think about a car chase, where the camera is in one car and you are filming the other. Better still, think of a helicopter chasing a car. The fluid movement of the helicopter dipping forward and flying around the car is a fantastic effect. You can do it with these 2 commands, a couple of objects and the most simple of mathematical commands (sin and cos).

Velorien
21
Years of Service
User Offline
Joined: 13th Sep 2003
Location:
Posted: 13th Sep 2003 15:43
Hi you can use the code for the camera from this example i made for my friends. Somehow i suceeded to make it smooth and to have its own collision or something so it can't pass trough walls. There is also a save game code what you can use if you want. Note that this code will not work because you don't have the model or the textures but you can copy/paste the parts you need. If you want the full source with models i will mail it to you, just contact me at velorien@hi.htnet.hr

Login to post a reply

Server time is: 2024-09-21 01:07:01
Your offset time is: 2024-09-21 01:07:01