Beispiel #1
0
        public int CreatePhysicsBody(PhysicBody body)
        {
            int id = new Random().Next();

            bodies.Add(id, body);
            return(id);
        }
        private void CsoSupport(Collider a, Collider b, Vec3f dir, out Vec3f support, out Vec3f supportA, out Vec3f supportB)
        {
            PhysicBody bodyA = a.body;
            PhysicBody bodyB = b.body;

            Vec3f localDirA = bodyA.GlobalToLocalDir(dir);
            Vec3f localDirB = bodyB.GlobalToLocalDir(-dir);

            supportA = a.FurthestPointInDirection(localDirA);
            supportB = b.FurthestPointInDirection(localDirB);

            supportA = bodyA.LocalToGlobalPos(supportA);
            supportB = bodyB.LocalToGlobalPos(supportB);

            support = supportA - supportB;
        }
Beispiel #3
0
 public void UpdatePhysicsBody(int id, PhysicBody body)
 {
     bodies[id] = body;
 }