Esempio n. 1
0
        private void resolve(Vector n)
        {
            // this is the tangent vector at the rim particle
            tan = new Vector(-rp.curr.Y, rp.curr.X);

            // normalize so we can scale by the rotational speed
            tan = tan.normalize();

            // velocity of the wheel's surface
            Vector wheelSurfaceVelocity = tan * rp.Speed;

            // the velocity of the wheel's surface relative to the ground
            this.Velocity += wheelSurfaceVelocity;
            Vector combinedVelocity = this.Velocity;

            // the wheel's comb velocity projected onto the contact normal
            float cp = combinedVelocity.Cross(n);

            // set the wheel's spinspeed to track the ground
            tan *= cp;
            rp.prev = rp.curr - tan;

            // some of the wheel's torque is removed and converted into linear displacement
            float slipSpeed = (1 - _traction) * rp.Speed;
            normSlip = new Vector(slipSpeed * n.Y, slipSpeed * n.X);
            curr += normSlip;
            rp.Speed = rp.Speed * _traction;
        }