コード例 #1
0
ファイル: JointSwivelHinge.cs プロジェクト: Morphan1/Voxalia
 public JointSwivelHinge(PhysicsEntity e1, PhysicsEntity e2, Location hinge, Location twist)
 {
     Ent1 = e1;
     Ent2 = e2;
     WorldHinge = hinge;
     WorldTwist = twist;
 }
コード例 #2
0
ファイル: JointPushPull.cs プロジェクト: Morphan1/Voxalia
 public JointPullPush(PhysicsEntity e1, PhysicsEntity e2, Location axis, bool mode)
 {
     Ent1 = e1;
     Ent2 = e2;
     Axis = axis;
     Mode = mode;
 }
コード例 #3
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);
     }
 }
コード例 #4
0
 public JointTwist(PhysicsEntity e1, PhysicsEntity e2, Location a1, Location a2)
 {
     Ent1 = e1;
     Ent2 = e2;
     AxisOne = a1;
     AxisTwo = a2;
 }
コード例 #5
0
ファイル: JointDistance.cs プロジェクト: Morphan1/Voxalia
 public JointDistance(PhysicsEntity e1, PhysicsEntity e2, float min, float max, Location e1pos, Location e2pos)
 {
     Ent1 = e1;
     Ent2 = e2;
     Min = min;
     Max = max;
     Ent1Pos = e1pos;
     Ent2Pos = e2pos;
 }
コード例 #6
0
ファイル: JointLAxisLimit.cs プロジェクト: Morphan1/Voxalia
 public JointLAxisLimit(PhysicsEntity e1, PhysicsEntity e2, float min, float max, Location cpos1, Location cpos2, Location axis)
 {
     Ent1 = e1;
     Ent2 = e2;
     Min = min;
     Max = max;
     CPos1 = cpos1;
     CPos2 = cpos2;
     Axis = axis;
 }
コード例 #7
0
        public void UpdateVehicle()
        {
            PhysicsEntity ve = (Vehicle as PhysicsEntity);
            int           id = CurrentVehiclePacketID;

            CurrentVehiclePacketID = (CurrentVehiclePacketID + 1) % PACKET_CAP;
            VehicleMarks[id]       = new VehicleStore()
            {
                Pos = ve.GetPosition(), Vel = ve.GetVelocity(), AVel = ve.GetAngularVelocity(), Quat = ve.GetOrientation(), Time = CurrentRemoteGTT
            };
            TheClient.Network.SendPacket(new MyVehiclePacketOut(id));
        }
コード例 #8
0
ファイル: Region.cs プロジェクト: Morphan1/Voxalia
 /// <summary>
 /// Spawns an entity in the world.
 /// </summary>
 /// <param name="e">The entity to spawn.</param>
 public void SpawnEntity(Entity e)
 {
     Entities.Add(e);
     if (e.Ticks)
     {
         Tickers.Add(e);
     }
     if (e.CastShadows)
     {
         ShadowCasters.Add(e);
     }
     if (e is PhysicsEntity)
     {
         PhysicsEntity pe = e as PhysicsEntity;
         pe.SpawnBody();
         if (pe.GenBlockShadows)
         {
             // TODO: Effic?
             PhysicsEntity[] neo = new PhysicsEntity[GenShadowCasters.Length + 1];
             Array.Copy(GenShadowCasters, neo, GenShadowCasters.Length);
             neo[neo.Length - 1] = pe;
             GenShadowCasters = neo;
             Chunk ch = TheClient.TheRegion.GetChunk(TheClient.TheRegion.ChunkLocFor(e.GetPosition()));
             if (ch != null)
             {
                 ch.CreateVBO(); // TODO: nearby / all affected chunks!
             }
         }
     }
     else if (e is PrimitiveEntity)
     {
         ((PrimitiveEntity)e).Spawn();
     }
 }
コード例 #9
0
ファイル: Region.cs プロジェクト: Morphan1/Voxalia
 public void Despawn(Entity e)
 {
     Entities.Remove(e);
     if (e.Ticks)
     {
         Tickers.Remove(e);
     }
     if (e.CastShadows)
     {
         ShadowCasters.Remove(e);
     }
     if (e is PhysicsEntity)
     {
         PhysicsEntity pe = e as PhysicsEntity;
         pe.DestroyBody();
         for (int i = 0; i < pe.Joints.Count; i++)
         {
             DestroyJoint(pe.Joints[i]);
         }
         if (pe.GenBlockShadows)
         {
             PhysicsEntity[] neo = new PhysicsEntity[GenShadowCasters.Length - 1];
             int x = 0;
             bool valid = true;
             for (int i = 0; i < GenShadowCasters.Length; i++)
             {
                 if (GenShadowCasters[i] != pe)
                 {
                     neo[x++] = GenShadowCasters[i];
                     if (x == GenShadowCasters.Length)
                     {
                         valid = false;
                         return;
                     }
                 }
             }
             if (valid)
             {
                 GenShadowCasters = neo;
             }
         }
     }
     else if (e is PrimitiveEntity)
     {
         ((PrimitiveEntity)e).Destroy();
     }
 }
コード例 #10
0
ファイル: JointNoCollide.cs プロジェクト: Morphan1/Voxalia
 public JointNoCollide(PhysicsEntity e1, PhysicsEntity e2)
 {
     One = e1;
     Two = e2;
 }
コード例 #11
0
ファイル: JointWeld.cs プロジェクト: Morphan1/Voxalia
 public JointWeld(PhysicsEntity e1, PhysicsEntity e2)
 {
     Ent1 = e1;
     Ent2 = e2;
 }
コード例 #12
0
 public JointSlider(PhysicsEntity e1, PhysicsEntity e2, Location dir)
 {
     Ent1 = e1;
     Ent2 = e2;
     Direction = dir;
 }
コード例 #13
0
 public JointBallSocket(PhysicsEntity e1, PhysicsEntity e2, Location pos)
 {
     Ent1 = e1;
     Ent2 = e2;
     Position = pos;
 }