Exemple #1
0
 public void VehiclePacketFromServer(int ID, Location pos, Location vel, Location avel, BEPUutilities.Quaternion quat, double gtt, Location prel)
 {
     if (VehicleMarks[ID].Time > 0)
     {
         Location off_pos  = pos - VehicleMarks[ID].Pos;
         Location off_vel  = vel - VehicleMarks[ID].Vel;
         Location off_avel = avel - VehicleMarks[ID].AVel;
         double   off_gtt  = MathHelper.Clamp(gtt - VehicleMarks[ID].Time, 0.001, 0.3) * 2.0;
         VehicleMarks[ID].Time = 0;
         if (!InVehicle || Vehicle == null)
         {
             return;
         }
         PhysicsEntity ve = (Vehicle as PhysicsEntity);
         if ((off_pos / off_gtt).LengthSquared() > vel.LengthSquared() * VEH_MINIMUM + VEH_MINIMUM)
         {
             SysConsole.Output(OutputType.DEBUG, "Own-Vehicle is insufficiently correcting! (Server lag?)");
         }
         //ve.SetPosition(ve.GetPosition() + off_pos * off_gtt);
         //ve.SetVelocity(ve.GetVelocity() + off_vel * off_gtt);
         ve.ServerKnownLocation = pos;
         ve.MoveToOffsetWithJoints(off_pos * off_gtt, off_vel * off_gtt, BEPUutilities.Quaternion.Slerp(ve.GetOrientation(), quat, off_gtt));
         ve.SetAngularVelocity(ve.GetAngularVelocity() + off_avel * off_gtt);
         //ve.SetOrientation(Quaternion.Slerp(ve.GetOrientation(), quat, off_gtt));
         //SetPosition(ve.GetPosition() + prel);
     }
 }