/// <summary> /// Constructs a new constraint which attempts to restrict the relative angular velocity of two entities to some value. /// </summary> /// <param name="entity">Affected entity.</param> public SingleEntityAngularMotor(Entity entity) { Entity = entity; settings = new MotorSettingsOrientation(this); //Since no target relative orientation was specified, just use the current relative orientation. Prevents any nasty start-of-sim 'snapping.' settings.servo.goal = base.entity.orientation; //mySettings.myServo.springSettings.stiffnessConstant *= .5f; }
/// <summary> /// Constructs a new constraint which attempts to restrict the angular velocity or orientation to a goal. /// </summary> /// <param name="entity">Affected entity.</param> public SingleEntityAngularMotor(Entity entity) { Entity = entity; Settings = new MotorSettingsOrientation(this) { servo = { goal = this.entity.orientation } }; //Since no target relative orientation was specified, just use the current relative orientation. Prevents any nasty start-of-sim 'snapping.' }
/// <summary> /// Constructs a new constraint which attempts to restrict the relative angular motion of two entities. /// </summary> /// <param name="connectionA">First connection of the pair.</param> /// <param name="connectionB">Second connection of the pair.</param> public AngularMotor(Entity connectionA, Entity connectionB) { ConnectionA = connectionA; ConnectionB = connectionB; Settings = new MotorSettingsOrientation(this); //Compute the rotation from A to B in A's local space. Quaternion orientationAConjugate; Quaternion.Conjugate(ref connectionA.orientation, out orientationAConjugate); Quaternion.Concatenate(ref connectionB.orientation, ref orientationAConjugate, out Settings.servo.goal); }
/// <summary> /// Constructs a new constraint which attempts to restrict the relative angular velocity of two entities to some value. /// This constructor will make the angular motor start with isActive set to false. /// </summary> public SingleEntityAngularMotor() { settings = new MotorSettingsOrientation(this); IsActive = false; }
/// <summary> /// Constructs a new constraint which attempts to restrict the relative angular motion of two entities. /// To finish the initialization, specify the connections (ConnectionA and ConnectionB). /// This constructor sets the constraint's IsActive property to false by default. /// </summary> public AngularMotor() { IsActive = false; Settings = new MotorSettingsOrientation(this); }