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 / Camera problems

Author
Message
MauganRa
21
Years of Service
User Offline
Joined: 28th Apr 2003
Location:
Posted: 2nd May 2003 07:05
I have a vehicle moving over a matrix and rolling with the terrain and I wish to place the camera on the vehicle to give the apperance that you are looking out from the vehicle. Because the vehicle is attached to a base object that gets the ground hight (as in the Limit Rush tutorial) the angles for the camera do not match that of the vehicle and as the vehicle moves the camera is left slightly behind. I hope some one can help as I have been trying to fix this poblem for a couple of weeks now but I cannot seem to get the code right.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 5th May 2003 01:54
Why can't you use the details of the base object then?

Thanks in advance.
All the Best,
StevieVee
Obear
21
Years of Service
User Offline
Joined: 13th Oct 2002
Location:
Posted: 5th May 2003 02:27
OK first if you could post the code we could see exactly what you have done.
But im gussing you have basicly placed the X,y,z of the camera co-ords at the same location as the x,y,z of the object co-ors insdie the main loop so the camera will alwasy be in the same location as the object.

If the camera is to the left and slighyl behind the onject, bear in mind that the XYZ of the OBJECT may not be its CENTER

it may well be the lower left corner of the object, so your camerea is being placed there.

In your code try adding a little extra to the XYZ of the CAMERA co-ors to compesate for this

IE

If your OBEJCT co-ors is say 10,10,10 and your object is 10x10x10 in SIZE
If the camrea is at 10,10,10 (the same as the object) and this is actually the lower left corner of the object. Adding 5 to eack of the object co-ords will get you its dead center.

So CAMERA co-ors will be
POSITION CAMERA Objectx+5,Objecty+5,Objectz+5

placeing the camera at the objectct co ords plus 5 to get dead center

But like i said im gussinghere as to this is what you mean, could do with a bit of code

MauganRa
21
Years of Service
User Offline
Joined: 28th Apr 2003
Location:
Posted: 5th May 2003 20:10
Thanks for your help guys but I think you may have misunderstood my post. I can position the camera to the base object and movement is fine but the problem is with the camera tilt.

What I want to do is have the vehicle remain in place in the screen while the land seems to tilt. When I use the same maths for the camera as the vehicle the angles work out different because the vehicles Y always reads 0 but the cameras Y changes.

If anyone can come up with a way to make it seem like the camera is attached to a object limb this would help. I have posted my move function to see if this will help.
MauganRa
21
Years of Service
User Offline
Joined: 28th Apr 2003
Location:
Posted: 5th May 2003 20:25
Bye the way I am using DBC v1.13
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 6th May 2003 01:05
Try this ( put a gosub update_camera in your do-loop)

update_camera:
rem Position camera to the back of the character
ca#=wrapvalue(a#)
cx#=newxvalue(x#,ca#,camdist)
cz#=newzvalue(z#,ca#,camdist)
cy#=get ground height(1,x#,z#)
position camera cx#,cy#+camhgt,cz#
rem Point camera at object
point camera x#,cy#+camhgt,z#
return

where:
a# = car Y angle
x# = car x# position ; z#= car z# position
1= object number for car (just replace with your values )
camdist= how much behind the car you want the camera (must be negative , try -300)
camhgt= height of your camera from ground (must be positive, try 100)

Login to post a reply

Server time is: 2024-09-20 08:06:11
Your offset time is: 2024-09-20 08:06:11