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.

Dark GDK / Locking Camera in 3D object

Author
Message
Kira
16
Years of Service
User Offline
Joined: 25th Jan 2008
Location:
Posted: 22nd May 2008 11:38
hi there folks

im trying to get a hood view of my car for my game but it ends up viewing the car sideways but when the car is stationary and i swing the mouse to left and right the car revolves on a point - its spinning while my camera is rotating.

got any ideas or code that i could work on to lock the camera to my car's hood?

thanks in advance
Tom Taylor
20
Years of Service
User Offline
Joined: 29th Dec 2003
Location: Germany
Posted: 22nd May 2008 14:24
Hi, there are many ways to do this. Basicly the math behind is to set the position and rotation of your cam the same to your car and then move it a fixed length along an fixed direction (vector). The cam will stay on the same position, relative to the car.

This commands might be the right choise, if you want to link the cam to an object (like a car):

Quote: "void dbSetCameraToObjectOrientation ( int iObject )"


Simply grab the orientation and place the cam. Now the cam is in the "center" of the car, but has the same direction.

Calculate the offset to the bump:

Hm I am not pretty sure, but you need a fixed point at first (vector). This point is relative to the car "center" where you want to place the cam (at the hood).

You just need to rotate this point the same like the object and add the position to the cam.

Tom Taylor
Kira
16
Years of Service
User Offline
Joined: 25th Jan 2008
Location:
Posted: 22nd May 2008 22:11
manage to do the code but it sets the camera on a sort of a "spectator's view" instead of placing the camera in the middle of the object.. or am i doing something wrong here?
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 22nd May 2008 22:16
The secret is in the "Toy"! Tom spelled it out in the first and second sentance!

The "Toy" is this thing I made in Iron Infantry - (DBPro version) - which if you ever download it http://code.google.com/p/ironinfantrydbpro/ you can see it in action.

It's just a "3d cursor" and some functionality tied to it. In short, you make it appear at the same position as the "model" and then you can move it, turn it etc. and it displays how far you moved it on each axis and how far you rotated on each axis.

Like... you would start in the car... and move it up a bit until windsheild height.... then left or right to driver seat (USA or Wrong Side (Just Kidding) ) then forward...

Then every time you move car, you move cam to same position and rotate as car,... then apply the #'s you gather from toy to move the camera from there .

Kira
16
Years of Service
User Offline
Joined: 25th Jan 2008
Location:
Posted: 22nd May 2008 22:23
thanks again jason, id love to chat with you in YM but im using somebody else's desktop

though i dont have DBPro here but i do want to see the codes though... ahehehe
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 22nd May 2008 22:26

Login to post a reply

Server time is: 2024-09-29 21:28:39
Your offset time is: 2024-09-29 21:28:39