Improve ant walking speed

This commit is contained in:
Pascal Serrarens 2026-05-05 14:05:51 +02:00
parent fdae20b6b4
commit 10d99bce87
4 changed files with 1840 additions and 1767 deletions

View File

@ -138,10 +138,10 @@ namespace CreatureControl {
UpdatePose();
// copy animator root motion to the creature
this.transform.SetPositionAndRotation(targetRig.transform.position, targetRig.transform.rotation);
//this.transform.SetPositionAndRotation(targetRig.transform.position, targetRig.transform.rotation);
// As target rig is probably a child of this.transform,
// We need to restore the position/rotation of the targetsRig.
targetRig.transform.SetPositionAndRotation(this.transform.position, this.transform.rotation);
//targetRig.transform.SetPositionAndRotation(this.transform.position, this.transform.rotation);
}
/// <summary>
@ -161,10 +161,16 @@ namespace CreatureControl {
public virtual void UpdateModel() {
if (this.model == null)
return;
Vector3 newPosition = this.targetRig.transform.position + this.targetToModelTranslation;
Quaternion newOrientation = this.targetRig.transform.rotation * this.targetToModelRotation;
this.targetRig.transform.GetPositionAndRotation(out Vector3 targetRigPosition, out Quaternion targetRigOrientation);
Vector3 newPosition = targetRigPosition + this.targetToModelTranslation;
Quaternion newOrientation = targetRigOrientation * this.targetToModelRotation;
this.model.SetPositionAndRotation(newPosition, newOrientation);
// This leads to problems when the targetRig is a child of the model
// (which is often the case)
// to prevent this, we restore the targetRig pose
this.targetRig.transform.SetPositionAndRotation(targetRigPosition, targetRigOrientation);
}
#region Collisions

View File

@ -503,6 +503,9 @@ namespace NanoBrain {
}
protected void DrawOutputs(Vector2 parentPos, float size) {
if (this.currentCluster == null)
return;
// Determine the maximum value in this layer
// This is used to 'scale' the output value colors of the nuclei
float maxValue = 0;

View File

@ -12,7 +12,7 @@ BlendTree:
m_Motion: {fileID: 7400000, guid: ab82ff68e62ea3b1c8e6523f8d46c142, type: 2}
m_Threshold: -1
m_Position: {x: 0, y: 1}
m_TimeScale: 1
m_TimeScale: 0.5
m_CycleOffset: 0
m_DirectBlendParameter: Forward
m_Mirror: 0
@ -28,7 +28,7 @@ BlendTree:
m_Motion: {fileID: 7400000, guid: 91229db5e929c379bbfd5bf417848488, type: 2}
m_Threshold: 1
m_Position: {x: 1, y: 0}
m_TimeScale: 1
m_TimeScale: 0.5
m_CycleOffset: 0
m_DirectBlendParameter: Forward
m_Mirror: 0
@ -51,7 +51,7 @@ BlendTree:
m_Motion: {fileID: 7400000, guid: 138594cdb62397137913b39c26d3de5a, type: 2}
m_Threshold: 0
m_Position: {x: 0, y: 0}
m_TimeScale: 1
m_TimeScale: 0.5
m_CycleOffset: 0
m_DirectBlendParameter: Forward
m_Mirror: 0
@ -59,7 +59,7 @@ BlendTree:
m_Motion: {fileID: 7400000, guid: b8a731a1533b8c960b3f3688d4922a24, type: 2}
m_Threshold: 0.25
m_Position: {x: 0, y: 1}
m_TimeScale: 1
m_TimeScale: 0.5
m_CycleOffset: 0
m_DirectBlendParameter: Forward
m_Mirror: 0
@ -67,7 +67,7 @@ BlendTree:
m_Motion: {fileID: 7400000, guid: 240c3a3c6c28272059bf7b591ff818b1, type: 2}
m_Threshold: 0.5
m_Position: {x: -1, y: 0}
m_TimeScale: 1
m_TimeScale: 0.5
m_CycleOffset: 0
m_DirectBlendParameter: Forward
m_Mirror: 0
@ -75,7 +75,7 @@ BlendTree:
m_Motion: {fileID: 7400000, guid: 501d5503172629df192bb4ad015fb4f7, type: 2}
m_Threshold: 0.75
m_Position: {x: 1, y: 0}
m_TimeScale: 1
m_TimeScale: 0.5
m_CycleOffset: 0
m_DirectBlendParameter: Forward
m_Mirror: 0
@ -83,7 +83,7 @@ BlendTree:
m_Motion: {fileID: 7400000, guid: b8a731a1533b8c960b3f3688d4922a24, type: 2}
m_Threshold: 1
m_Position: {x: 0, y: -1}
m_TimeScale: -1
m_TimeScale: -0.5
m_CycleOffset: 0
m_DirectBlendParameter: Forward
m_Mirror: 0

File diff suppressed because it is too large Load Diff