Beispiel #1
0
        public override void Iterate()
        {
            if (Rotate == Rotate.Clockwise)
            {
                Body1.IsActive = true;
                JVector torque = new JVector(0, 0, 1);
                torque = JVector.Transform(torque, Body1.Orientation);
                torque = JVector.Transform(torque, Body1.Inertia);
                Body1.AddTorque(torque * Body1.Mass);
            }

            if (Rotate == Rotate.Anticlockwise)
            {
                Body1.IsActive = true;
                JVector torque = new JVector(0, 0, -1);
                torque = JVector.Transform(torque, Body1.Orientation);
                torque = JVector.Transform(torque, Body1.Inertia);
                Body1.AddTorque(torque * Body1.Mass);
            }

            if (Direction == Walk.Forward)
            {
                Body1.IsActive = true;
                JVector force = new JVector(1, 0, 0);
                force = JVector.Transform(force, Body1.Orientation);
                Body1.AddForce(force * Body1.Mass);
            }

            if (Direction == Walk.Backward)
            {
                Body1.IsActive = true;
                JVector force = new JVector(-1, 0, 0);
                force = JVector.Transform(force, Body1.Orientation);
                Body1.AddForce(force * Body1.Mass);
            }
        }