Пример #1
0
    // Shared tilt angles for all rotors.
    public void StepUpdate(Quaternion rot, float yaw, float thrust, float deltaTime)
    {
        Quaternion r = Quaternion.Inverse(rot) * transform.localRotation;

        stepTiltZ.Update(Util.ClampAngle(r.eulerAngles.z + yaw * signZ, -maxTiltAngle, maxTiltAngle), deltaTime);
        stepTiltX.Update(Util.ClampAngle(r.eulerAngles.x + yaw * signX, -maxTiltAngle, maxTiltAngle), deltaTime);
        jointZ.targetRotation = Quaternion.Euler(0, 0, stepTiltZ.Value);
        jointX.targetRotation = Quaternion.Euler(stepTiltX.Value, 0, 0);

        StepUpdate(thrust, deltaTime);
    }
Пример #2
0
 public void StepUpdate(float thrust, float deltaTime)
 {
     stepThrust.Update(thrust, deltaTime);
     currentThrust = isReversable ? stepThrust.Value : (stepThrust.Value + 1f) * 0.5f;
     rbInnerRing.AddForce(innerRing.up * currentThrust * thrustScale, ForceMode.Impulse);
     rbInnerRing.AddRelativeTorque(innerRing.up * currentThrust * torqueScale * -signSpin, ForceMode.Impulse);
 }