Duality.Components.Physics.RigidBody.InitBody C# (CSharp) Méthode

InitBody() private méthode

private InitBody ( ) : void
Résultat void
        private void InitBody()
        {
            if (this.body != null) this.CleanupBody();
            Transform t = this.GameObj != null ? this.GameObj.Transform : null;

            this.body = new Body(Scene.PhysicsWorld, this);
            SetFarseerBodyType(this.bodyType);
            this.body.LinearDamping = this.linearDamp;
            this.body.AngularDamping = this.angularDamp;
            this.body.FixedRotation = this.fixedAngle;
            this.body.IgnoreGravity = this.ignoreGravity;
            this.body.IsBullet = this.continous;
            this.body.CollisionCategories = this.colCat;
            this.body.CollidesWith = this.colWith;

            this.UpdateBodyShape();

            if (t != null)
            {
                this.body.SetTransform(PhysicsConvert.ToPhysicalUnit(t.Pos.Xy), t.Angle);
                this.body.LinearVelocity = PhysicsConvert.ToPhysicalUnit(this.linearVel) / Time.SPFMult;
                this.body.AngularVelocity = this.angularVel / Time.SPFMult;
            }

            this.body.Collision += this.body_OnCollision;
            this.body.Separation += this.body_OnSeparation;
            this.body.PostSolve += this.body_PostSolve;

            //var testJoint = JointFactory.CreateFixedAngleJoint(Scene.CurrentPhysics, this.body);
            //var testJoint = JointFactory.CreateFixedDistanceJoint(Scene.CurrentPhysics, this.body, Vector2.Zero, Vector2.Zero);
            //var testJoint = JointFactory.CreateFixedFrictionJoint(Scene.CurrentPhysics, this.body, Vector2.Zero);
            //var testJoint = JointFactory.CreateFixedPrismaticJoint(Scene.CurrentPhysics, this.body, Vector2.Zero, Vector2.UnitX);
            //var testJoint = JointFactory.CreateFixedRevoluteJoint(Scene.CurrentPhysics, this.body, Vector2.Zero, Vector2.Zero);

            // etc.
            //var testJoint = JointFactory.CreateAngleJoint(
        }