Author Topic: Correct client sided eye vector  (Read 763 times)

I'm trying to get the correct vector for a client's eye point while driving a vehicle


function getmyeyepoint()
{
   %player = serverconnection.getcontrolob ject();

   if(!isobject(%player))
      return "0 0 0";
   %pos=%player.getPosition()
   %vec = %player.getforwardvector();
   %scale = %player.getscale();
   %x = getword(%pos, 0) + (getword(%vec, 0)*0.14 + 0.002)*getword(%scale, 0); //me no likey
   %y = getword(%pos, 1) + (getword(%vec, 1)*0.14 + 0.002)*getword(%scale, 1);
   %z = getword(%pos, 2) + (getword(%player.getdatablock().boundingbox, 2)/4.92 + $mvTrigger3*1.53 + 0.002)*getword(%scale, 2);
   return %x SPC %y SPC %z;
}


muzzle vector in vehicles is always forward in first person, is there any way to fix this?

Eye vector or eye point?

Muzzle vector will work in first person when in a vehicle but not in third person I believe.

Muzzle vector will work in first person when in a vehicle but not in third person I believe.
false

false

Well, it is true in the sense that being in first person fixes the z component of the muzzle vector, where third person always has a z component of 0.  However, what is really happening is that your blockhead is still always facing forward, and just your head will turn.  This means that while the muzzle vector is correct, it is not a great representation of your eye vector.  I do not think there is any way to fix this.  Even if you look toward a wall to your left in first person in a vehicle, the focus distance function still returns the distance to the next object in front of you, and not to the wall.