Here is the code (a little out of context, but should still be representative) I wrote thus far, any assistance is greatly appreciated!
Code: Select all
//Setup code
Entity fixedPivotLocation = new Box(Vector3.Zero, .1f, .1f, .1f);
fixedPivotLocation.IsAffectedByGravity = false;
fixedPivotLocation.IsAlwaysActive = true;
game.PhysicsManager.Space.Add(fixedPivotLocation);
entity= new Box(new Vector3(0, 0, 1), .1f, .1f, .1f, 1);
entity.IsAffectedByGravity = false;
entity.IsAlwaysActive = true;
//entity.CollisionInformation.CollisionRules.Personal = CollisionRule.NoBroadPhase; //prevent entityfrom interacting with anything
game.PhysicsManager.Space.Add(entity);
BallSocketJoint joint = new BallSocketJoint(fixedPivotLocation, entity, fixedPivotLocation.Position);
joint.IsActive = true;
game.PhysicsManager.Space.Add(joint);
motor = new AngularMotor(fixedPivotLocation, entity);
motor.Settings.Mode = MotorMode.Servomechanism;
motor.IsActive = true;
motor.Settings.Servo.Goal = Quaternion.CreateFromYawPitchRoll(0, 0, 1);
motor.Settings.MaximumForce = 100;
game.PhysicsManager.Space.Add(motor);
//*This code is called on each frame update
GoalPosition = UserInput;
motor.Settings.Servo.Goal = Quaternion.CreateFromYawPitchRoll(GoalPosition.X * (float)MathHelper.PiOver2, GoalPosition.Y * (float)MathHelper.PiOver2, GoalPosition.Z * (float)MathHelper.PiOver2);