Advertisement
Guest User

Untitled

a guest
May 3rd, 2016
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.11 KB | None | 0 0
  1. using NodeCanvas.Framework;
  2. using ParadoxNotion.Design;
  3. using RootMotion.FinalIK;
  4. using UnityEngine;
  5.  
  6. namespace NodeCavasAddons.FinalIK
  7. {
  8.     [Category("FinalIK/Look At")]
  9.     [Name("Simple Look At Target")]
  10.     [Description("A simple task wrapping up underlying functionality to target directly from the IK")]
  11.     [Icon("FinalIKLook")]
  12.     [AgentType(typeof(LookAtIK))]
  13.     public class SimpleLookAtTargetAction : ActionTask
  14.     {
  15.         [GetFromAgent]
  16.         private LookAtIK _ik;
  17.  
  18.         [RequiredField]
  19.         public BBParameter<GameObject> Effector;
  20.        
  21.         [RequiredField]
  22.         [SliderField(0, 1.0f)]
  23.         public BBParameter<float> PositionWeight;
  24.        
  25.         protected override string info
  26.         {
  27.             get { return string.Format("Look At Targetting {0}\nWith Weight {1}", Effector, PositionWeight); }
  28.         }
  29.        
  30.         protected override void OnExecute()
  31.         {
  32.             _ik.solver.IKPosition = Effector.value.transform.position;
  33.             _ik.solver.IKPositionWeight = PositionWeight.value;
  34.             EndAction(true);
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement