示例#1
0
        public SphereRigid(SphereRigid anotherRB)
            : base(MathHelperModule.GetSphereRigid2DCoordinatesPositionXNA(anotherRB.PositionXNA, anotherRB.Radius),
                   MathHelperModule.GetPositionCenter(anotherRB.PositionXNA, anotherRB.Radius), TextureType.DefaultCircle)
        {
            this._positionCenter = anotherRB.PositionXNA;
            this._positionCenter = anotherRB.PositionCenterEngine;

            this.Width  = anotherRB.Width;
            this.Height = anotherRB.Height;

            this.vertices = RigidsHelperModule.MakeNewVPCMatrix(anotherRB.vertices);
            this.InverseInertiaTensorWorld = anotherRB.InverseInertiaTensorWorld;


            this.baseMomentOfInertia = anotherRB.baseMomentOfInertia;
            //this.basicEffect = anotherRB.basicEffect;
            this.acceleration          = anotherRB.acceleration;
            this.canSleep              = anotherRB.canSleep;
            this.Center                = anotherRB.Center;
            this.dAngle                = anotherRB.dAngle;
            this.torqueAccum           = anotherRB.torqueAccum;
            this.torque                = anotherRB.torque;
            this.EnlargingFactor       = anotherRB.EnlargingFactor;
            this.gravity               = anotherRB.gravity;
            this.Radius                = anotherRB.Radius;
            this.isAwake               = anotherRB.isAwake;
            this.IsCollidable          = anotherRB.IsCollidable;
            this.IsClicked             = anotherRB.IsClicked;
            this.LastFrameAcceleration = anotherRB.LastFrameAcceleration;
            this.LastFrameVelocity     = anotherRB.LastFrameVelocity;
            this.Mass            = anotherRB.Mass;
            this.InvMass         = anotherRB.InvMass;
            this.material        = anotherRB.material;
            this.motion          = anotherRB.motion;
            this.orientation     = anotherRB.orientation;
            this.RectangleArea   = anotherRB.RectangleArea;
            this.TextureType     = anotherRB.TextureType;
            this.sleepEpsilon    = anotherRB.sleepEpsilon;
            this.angVelocity     = anotherRB.angVelocity;
            this.angAcceleration = anotherRB.angAcceleration;
            this.divisions       = anotherRB.divisions;
            this.wired           = anotherRB.wired;
            this.InitRotation    = anotherRB.InitRotation;
            this.InitTorque      = anotherRB.InitTorque;
        }
示例#2
0
        public BoxRigid(BoxRigid anotherRB)
            : base(
                MathHelperModule.GetBoxRigid2DCoordinatesPositionXNA(anotherRB.PositionXNA, anotherRB.HalfSize.X, anotherRB.HalfSize.Y),
                MathHelperModule.GetPositionCenter(anotherRB.PositionXNA, anotherRB.HalfSize.X, anotherRB.HalfSize.Y), TextureType.DefaultBox)
        {
            //this.HalfSize = anotherRB.HalfSize;
            //this.PositionCenterEngine = MathHelperModule.GetPositionCenter(anotherRB.PositionXNA, anotherRB.HalfSize.X,
            //                                                         anotherRB.HalfSize.Y);
            //this.RectangleArea = MathHelperModule.GetBoxRigid2DCoordinatesPositionCenter(anotherRB.PositionCenterEngine,
            //                                                                             anotherRB.HalfSize.X,
            //                                                                             anotherRB.HalfSize.Y);
            //SetMaterial(anotherRB.material);
            //SetMass(HalfSize);

            //baseMomentOfInertia = Mass * Math.Max(HalfSize.X, HalfSize.Y) * Math.Max(HalfSize.X, HalfSize.Y) * 4 / 12f;
            //dAngle = 0;
            //vertices = new VertexPositionColor[5];
            //velocity = new Vector3(0, 0, 0);

            //InverseInertiaTensorWorld = new Matrix();
            //InverseInertiaTensorWorld.M11 = InverseInertiaTensorWorld.M22 = InverseInertiaTensorWorld.M33 = (float)1 / baseMomentOfInertia;
            //InverseInertiaTensorWorld.M44 = 1;

            //vertices[0].Position = this.PositionCenterEngine + new Vector3(HalfSize.X, HalfSize.Y, 0);
            //vertices[1].Position = this.PositionCenterEngine + new Vector3(-HalfSize.X, HalfSize.Y, 0);
            //vertices[2].Position = this.PositionCenterEngine + new Vector3(-HalfSize.X, -HalfSize.Y, 0);
            //vertices[3].Position = this.PositionCenterEngine + new Vector3(HalfSize.X, -HalfSize.Y, 0);
            //vertices[4].Position = this.PositionCenterEngine + new Vector3(HalfSize.X, HalfSize.Y, 0);

            this._positionCenter = anotherRB.PositionXNA;
            this._positionCenter = anotherRB.PositionCenterEngine;

            this.Width  = anotherRB.Width;
            this.Height = anotherRB.Height;

            this.vertices = RigidsHelperModule.MakeNewVPCMatrix(anotherRB.vertices);
            this.InverseInertiaTensorWorld = anotherRB.InverseInertiaTensorWorld;


            this.baseMomentOfInertia = anotherRB.baseMomentOfInertia;
            //this.basicEffect = anotherRB.basicEffect;
            this.acceleration          = anotherRB.acceleration;
            this.canSleep              = anotherRB.canSleep;
            this.Center                = anotherRB.Center;
            this.dAngle                = anotherRB.dAngle;
            this.torqueAccum           = anotherRB.torqueAccum;
            this.torque                = anotherRB.torque;
            this.EnlargingFactor       = anotherRB.EnlargingFactor;
            this.gravity               = anotherRB.gravity;
            this.HalfSize              = anotherRB.HalfSize;
            this.isAwake               = anotherRB.isAwake;
            this.IsCollidable          = anotherRB.IsCollidable;
            this.IsClicked             = anotherRB.IsClicked;
            this.LastFrameAcceleration = anotherRB.LastFrameAcceleration;
            this.LastFrameVelocity     = anotherRB.LastFrameVelocity;
            this.Mass            = anotherRB.Mass;
            this.InvMass         = anotherRB.InvMass;
            this.material        = anotherRB.material;
            this.motion          = anotherRB.motion;
            this.orientation     = anotherRB.orientation;
            this.RectangleArea   = anotherRB.RectangleArea;
            this.TextureType     = anotherRB.TextureType;
            this.sleepEpsilon    = anotherRB.sleepEpsilon;
            this.angVelocity     = anotherRB.angVelocity;
            this.angAcceleration = anotherRB.angVelocity;
            this.XAxis           = anotherRB.XAxis;
            this.YAxis           = anotherRB.YAxis;
        }