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 in Direction

Author
Message
Ub3rS0ldAt Patriot of War
20
Years of Service
User Offline
Joined: 8th Dec 2003
Location: United States! Support the Soldiers!
Posted: 19th Dec 2003 03:23
How do I get the default camera to always look in the direction the vehicle or object is moving.

I'm pretty new at this, so I need a quick answer.

The code is below, but you can download the file below the code.




http://www.freewebs.com/antalis/files/beta1.rar
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 19th Dec 2003 04:54
Well, do you have the camera following the car yet?

If not...
dist#=distance that you want the camera from the car

cx#=object position x(car.carnum)+cos(object angle y(car.carnum))*dist#
cy#=get matrix height(1,object position x(car.carnum),object position z(car.carnum))
cz#=object position z(car.carnum)+sin(object angle y(car.carnum))*dist#
position camera cx#,cy#,cz#
point camera object position x(car.carnum),object position y(car.carnum),object position z(car.carnum)

Is car.carnum your car object? This code should work... The dist# variable should be set to how far you want the camera from your car, I don't know what your scale is like.

Good Luck

Xander - Bolt Software

Don't pat yourself on the back too often, you might hurt yourself
Ub3rS0ldAt Patriot of War
20
Years of Service
User Offline
Joined: 8th Dec 2003
Location: United States! Support the Soldiers!
Posted: 19th Dec 2003 06:11 Edited at: 19th Dec 2003 06:13
Have you tested the test prog? That will explain things. I just want to know what code do I add to make the camera face the direction of movement. In the code, the camera is pointing to the origin of the model not in the direct the model is going. Please, help me.

The code works, but if you try the prog, you will notice that it is a fixed camera moving where ever the model goes, but I don't want that.

Login to post a reply

Server time is: 2024-09-21 15:09:27
Your offset time is: 2024-09-21 15:09:27