A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by Username » Fri Apr 28, 2006 3:32 pm
Ive been trying to figure out how to get the camera to stay behind the player. i have the direction it should be looking down, but i cant get it to move to behind the player. it starts looking at the vehicle, and as you turn, the camera direction changes to the direction the vehicles facing. sorry but im kinda noobed when it comes to cameras. i remember seeing a link on the site somewhere with a demo with something to do this but i havent seen it since. im not got at explaining things so heres a diagram. (here comes that FUN PART!!!)
in this example the label before the > is supposed to be what im talking about
so camera> is the camera and the >is the direction. confused yet?
camera> car>
thats the camera at the start. now onces i take a right,
camera\/ car\/
what im looking for is,
camera\/
car\/
if someone else who can understand my example knows something that will help can ya give me a hand here. thanks. oh and by the way, the camera isnt supposed to be to the right of the car. the forum removed my spaces. it looked good when i typed it out.
-
Username
-
- Posts: 5
- Joined: Fri Nov 05, 2004 1:19 am
by dhenton9000 » Fri Apr 28, 2006 3:52 pm
Depending on your graphics engine, you may need to cover things like car rotates camera because camera is a child of car.
Lookat position
camera position
I solved this problem myself by having a function that can take a global position and change it to local for a given node, or local to global.
"Behind the car" is a local matrix, you need to calculate the global matrix for being "behind the car". "behind the car and looking out in front of the car" is two local matrices one for the camera and one for the look at position of the camera (set Target for Irrlicht). If you can express the local matrices, translate them to global, you should have it.
I have sample code, but its for Irrlicht.
-
dhenton9000
-
- Posts: 8
- Joined: Fri May 06, 2005 5:58 pm
by Username » Sun Apr 30, 2006 12:06 am
crud. all i have is gamestudio. does anyone with gamestudio know how i can get it to work?
-
Username
-
- Posts: 5
- Joined: Fri Nov 05, 2004 1:19 am
by Username » Sun Apr 30, 2006 12:29 am
ive tried to use the camera in the vehicle demo as a base but i cant seem to get the camera to MOVE behind the car. lets say where it starts is south of the car. when it starts, it is looking north at the car. the car is also looking north. but if you turn west, the camera is still south of the car, and now looking west. you get my point? i need a way to get the camera to swing back behind the car as you turn. i tried messing with the original in the demo and couldnt get any farther than the example i gave here.
-
Username
-
- Posts: 5
- Joined: Fri Nov 05, 2004 1:19 am
by MatAllum » Sat May 27, 2006 9:35 pm
Click the right mouse button and drag (in the gstudio demo). The camera rotates around the car.
Look in move_camera - it's a starter function. ("starter move_camera()")
Replace the mouse functions with something that will make CAM_ANG.PAN the same as P_VEHICLE.PAN minus 180. That last part is to make sure the camera looks at the back of the vehicle and not the front.
cam_ang.pan = (p_vehicle.pan - 180);
-
MatAllum
-
- Posts: 21
- Joined: Mon Sep 06, 2004 5:48 pm
-
by Username » Mon Jun 19, 2006 1:42 am
thank you thank you thank you!!!!
-
Username
-
- Posts: 5
- Joined: Fri Nov 05, 2004 1:19 am
by Username » Mon Jun 19, 2006 1:54 am
* now i need d to figure out how to get the camera locked totally. all i can get it to do is when the car slants up to slant down. any ideas? i really stink at this
-
Username
-
- Posts: 5
- Joined: Fri Nov 05, 2004 1:19 am
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 37 guests