AngleAxis.cs 895 B

123456789101112131415161718192021222324252627282930
  1. using UnityEngine;
  2. namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityQuaternion
  3. {
  4. [TaskCategory("Unity/Quaternion")]
  5. [TaskDescription("Stores the rotation which rotates the specified degrees around the specified axis.")]
  6. public class AngleAxis : Action
  7. {
  8. [Tooltip("The number of degrees")]
  9. public SharedFloat degrees;
  10. [Tooltip("The axis direction")]
  11. public SharedVector3 axis;
  12. [Tooltip("The stored result")]
  13. [RequiredField]
  14. public SharedQuaternion storeResult;
  15. public override TaskStatus OnUpdate()
  16. {
  17. storeResult.Value = Quaternion.AngleAxis(degrees.Value, axis.Value);
  18. return TaskStatus.Success;
  19. }
  20. public override void OnReset()
  21. {
  22. degrees = 0;
  23. axis = Vector3.zero;
  24. storeResult = Quaternion.identity;
  25. }
  26. }
  27. }