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