コード例 #1
0
 public bool AddNewObject(Gobject gob)
 {
     lock (newObjects)
     {
         if (gameObjects.ContainsKey(gob.ID) ||
             newObjects.ContainsKey(gob.ID))
             return false;
         newObjects.Add(gob.ID, gob);
     }
     return true;
 }
コード例 #2
0
ファイル: PhysicsManager.cs プロジェクト: suzuke/3DPhysics
 public bool AddNewObject(Gobject gob)
 {
     lock (newObjects)
     {
         if (gameObjects.ContainsKey(gob.ID) ||
             newObjects.ContainsKey(gob.ID))
         {
             return(false);
         }
         newObjects.Add(gob.ID, gob);
     }
     return(true);
 }
コード例 #3
0
ファイル: PhysicsManager.cs プロジェクト: suzuke/3DPhysics
        public Gobject GetSphere(Vector3 pos, float radius, Model model, bool moveable)
        {
            Sphere  spherePrimitive = new Sphere(pos, radius);
            Gobject sphere          = new Gobject(
                pos,
                Vector3.One * radius,
                spherePrimitive,
                model,
                moveable,
                "sphere");

            //newObjects.Add(sphere.ID, sphere);
            return(sphere);
        }
コード例 #4
0
ファイル: PhysicsManager.cs プロジェクト: suzuke/3DPhysics
        private Gobject GetBox(Vector3 pos, Vector3 size, Matrix orient, Model model, bool moveable)
        {
            // position of box was upper leftmost corner
            // body has world position
            // skin is relative to the body
            Box boxPrimitive = new Box(-.5f * size, orient, size); // relative to the body, the position is the top left-ish corner instead of the center, so subtract from the center, half of all sides to get that point.

            Gobject box = new Gobject(
                pos,
                size / 2,
                boxPrimitive,
                model,
                moveable,
                "cube"
                );

            //newObjects.Add(box.ID, box);
            return(box);
        }
コード例 #5
0
        private Gobject GetBox(Vector3 pos, Vector3 size, Matrix orient, Model model, bool moveable)
        {
            // position of box was upper leftmost corner
            // body has world position
            // skin is relative to the body
            Box boxPrimitive = new Box(-.5f * size, orient, size); // relative to the body, the position is the top left-ish corner instead of the center, so subtract from the center, half of all sides to get that point.

            Gobject box = new Gobject(
                pos,
                size / 2,
                boxPrimitive,
                model,
                moveable,
                "cube"
                );

            //newObjects.Add(box.ID, box);
            return box;
        }
コード例 #6
0
        public Gobject GetSphere(Vector3 pos, float radius, Model model, bool moveable)
        {
            Sphere spherePrimitive = new Sphere(pos, radius);
            Gobject sphere = new Gobject(
                pos,
                Vector3.One * radius,
                spherePrimitive,
                model,
                moveable,
                "sphere");

            //newObjects.Add(sphere.ID, sphere);
            return sphere;
        }