コード例 #1
0
        public static PhysicsObject CreateStaticBox(Vec2 start, Vec2 end, bool locked, aShader shader, float mass)
        {
            var oAabb = new AABB
            {
                Min = new Vec2 {
                    X = start.X, Y = start.Y
                },
                Max = new Vec2 {
                    X = end.X, Y = end.Y
                }
            };

            PhysMath.CorrectBoundingBox(ref oAabb);
            var obj = new PhysicsObject(oAabb, PhysicsObject.Type.Box, .95F, locked, shader, mass);

            ListStaticObjects.Add(obj);
            return(obj);
        }
コード例 #2
0
        public static PhysicsObject CreateStaticCircle(Vec2 loc, int radius, float restitution, bool locked, aShader shader)
        {
            var oAabb = new AABB
            {
                Min = new Vec2 {
                    X = loc.X - radius, Y = loc.Y - radius
                },
                Max = new Vec2 {
                    X = loc.X + radius, Y = loc.Y + radius
                }
            };

            PhysMath.CorrectBoundingBox(ref oAabb);
            var obj = new PhysicsObject(oAabb, PhysicsObject.Type.Circle, restitution, locked, shader);

            ListStaticObjects.Add(obj);
            return(obj);
        }