Ejemplo n.º 1
0
        /// <summary>
        /// CREATES A BODY WITH MASS AND INERTIA
        /// </summary>
        /// <param name="mass"></param>
        /// <param name="moment"></param>
        public cpBody(float mass, float moment)
        {
            transform = new cpTransform();

            this.cog   = cpVect.Zero;
            this.space = null;

            this.shapeList      = null;
            this.arbiterList    = null;          // These are both wacky linked lists.
            this.constraintList = null;

            velocity_func = UpdateVelocity;
            position_func = UpdatePosition;

            // This stuff is used to track information on the collision graph.
            this.nodeRoot     = null;
            this.nodeNext     = null;
            this.nodeIdleTime = 0;

            /// Position of the rigid body's center of gravity.
            this.p = cpVect.Zero;
            /// Velocity of the rigid body's center of gravity.
            this.v = cpVect.Zero;
            /// Force acting on the rigid body's center of gravity.
            this.f = cpVect.Zero;


            /// Angular velocity of the body around it's center of gravity in radians/second.
            this.w = 0;
            /// Torque applied to the body around it's center of gravity.
            this.t = 0;

            // This stuff is all private.
            this.v_bias = cpVect.Zero;             //x = this.v_biasy = 0;
            this.w_bias = 0;

            this.userData = null;

            this.SetMass(mass);
            this.SetMoment(moment);
            this.SetAngle(0.0f);
        }
Ejemplo n.º 2
0
 public void SetPositionUpdateFunc(cpBodyPositionFunc positionFunc)
 {
     this.position_func = positionFunc;
 }