Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: eigenlambda on April 16, 2010, 12:19:22 am

Title: how do i find the player's head?
Post by: eigenlambda on April 16, 2010, 12:19:22 am
There doesn't seem to be a way to find out the player's eyepoint from Lua.  It looks like the intention was to have a model have a list of eyepoints, but it was never implemented.

It would be nice to know because my airquake mouse mod is currently a chasecam, but in physics/physics.cpp we find the comment that the player is never supposed to be able to have his eye orientation stray more than π/2 from his ship's orientation.  Also, chasecam isn't as good for precise targeting, as required for weapons that you can't constantly shoot.  But in order to move the camera back into the ship, we need to know where on the ship the camera belongs.

Any ideas?  Is it possible to manipulate the camera orientation without needing this information?
Title: Re: how do i find the player's head?
Post by: Galemp on April 16, 2010, 09:48:25 am
Well, ChaseCam is already implemented-- it's the decimal point on your number pad. You can also find the eyepoints for individual fighters using ModelView or PCS. But if you're looking to pull "player_eyepoint_position" or something for scripting, I can't help you.
Title: Re: how do i find the player's head?
Post by: Herra Tohtori on April 16, 2010, 09:50:27 am
Look for the boxes that say "HEADZ".
Title: Re: how do i find the player's head?
Post by: Spoon on April 16, 2010, 10:38:58 am
 :headz:
.pof's without manually added eyepoints take the 0,0,0 (pivot point) as eyepoint
Title: Re: how do i find the player's head?
Post by: Wobble73 on April 16, 2010, 01:13:27 pm
Look above his shoulders, a majority of the time, that's where the head is, atop of some thing called the neck.
 :lol:
Title: Re: how do i find the player's head?
Post by: mjn.mixael on April 16, 2010, 01:26:42 pm
Somehow, I just knew this topic was going to go downhill when I read the title...
Title: Re: how do i find the player's head?
Post by: Nuke on April 16, 2010, 06:13:24 pm
id just create a camera, probibly without attatching it to the ship. use the ships radius or bounding box to guestimate how big it is (and how far behind it to place the camera), and compute an offset above and behind the ship, far enough back to see the word more than the ship but not so far you cant see the model. now airquake kinda used an orbital type camera so you will need need to come up with an orientation matrix that represents this rotation and unrotate the offset by it (i think). you would probibly use mouse deltas to come up with a fresh matrix and multiply your current view matrix by it every frame. this should pivot the viewpoint vector around the ship. you will then most likely have to add the ships world position to that. this gets the camera world position, now you need to figure out its orientation. you will want to look in the general direction of the ship, but not directly at it. if you want things to be exactly like airquake where the cameras roll was always level to the horizon, you could simply subtract the ship position from the camera position, zero out the y component and then create an orientation from the vector and set the camera to it. this is probibly not 100% correct, id have to actually implement it to check the math.
Title: Re: how do i find the player's head?
Post by: Aardwolf on April 17, 2010, 03:08:02 pm
There doesn't seem to be a way to find out the player's eyepoint from Lua.  It looks like the intention was to have a model have a list of eyepoints, but it was never implemented.

Yeah, it was never implemented. As such, the whole eyepoint structure is completely useless.