Ensure model follows target in editor
This commit is contained in:
parent
018c99dce5
commit
481829c873
@ -94,6 +94,13 @@ namespace Passer.CreatureControl {
|
||||
}
|
||||
|
||||
#endregion Update
|
||||
|
||||
void OnDrawGizmos() {
|
||||
// This ensures that the model is always following the target rig
|
||||
if (Application.isPlaying == false) {
|
||||
this.Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -14,17 +14,14 @@ namespace Passer.CreatureControl {
|
||||
public Quaternion targetToBoneFemur;
|
||||
public Quaternion targetToBoneTibia;
|
||||
|
||||
private void Start() { }
|
||||
|
||||
public void MatchTo(Leg leg) {
|
||||
this.femurTarget.position = leg.femur.position;
|
||||
this.tibiaTarget.position = leg.tibia.position;
|
||||
this.tarsusTarget.position = leg.tarsus.position;
|
||||
targetToBoneFemur = InsectRig.TargetToBoneRotation(leg.femur, leg.tibia);
|
||||
targetToBoneTibia = InsectRig.TargetToBoneRotation(leg.tibia, leg.tarsus);
|
||||
targetToBoneFemur = TargetRig.TargetToBoneRotation(leg.femur, leg.tibia);
|
||||
targetToBoneTibia = TargetRig.TargetToBoneRotation(leg.tibia, leg.tarsus);
|
||||
|
||||
this.target.position = this.tarsusTarget.position;
|
||||
this.target.rotation = this.tarsusTarget.rotation;
|
||||
this.target.SetPositionAndRotation(this.tarsusTarget.position, this.tarsusTarget.rotation);
|
||||
}
|
||||
|
||||
public virtual void OnDrawGizmosSelected() {
|
||||
@ -133,10 +130,6 @@ namespace Passer.CreatureControl {
|
||||
return (float)angle;
|
||||
}
|
||||
|
||||
private static float Square(float x) {
|
||||
return x * x;
|
||||
}
|
||||
|
||||
#endregion Math
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user