Dot.cs 863 B

1234567891011121314151617181920212223242526272829
  1. using UnityEngine;
  2. namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityQuaternion
  3. {
  4. [TaskCategory("Unity/Quaternion")]
  5. [TaskDescription("Stores the dot product between two rotations.")]
  6. public class Dot : Action
  7. {
  8. [Tooltip("The first rotation")]
  9. public SharedQuaternion leftRotation;
  10. [Tooltip("The second rotation")]
  11. public SharedQuaternion rightRotation;
  12. [Tooltip("The stored result")]
  13. [RequiredField]
  14. public SharedFloat storeResult;
  15. public override TaskStatus OnUpdate()
  16. {
  17. storeResult.Value = Quaternion.Dot(leftRotation.Value, rightRotation.Value);
  18. return TaskStatus.Success;
  19. }
  20. public override void OnReset()
  21. {
  22. leftRotation = rightRotation = Quaternion.identity;
  23. storeResult = 0;
  24. }
  25. }
  26. }