v3 working transformations and working knie offset :D
This commit is contained in:
+21
-1
@@ -25,6 +25,10 @@ public class Foot : Component
|
|||||||
public double rotationX=0, rotationY=0, rotationZ=0;
|
public double rotationX=0, rotationY=0, rotationZ=0;
|
||||||
public double O1, O2, O3;
|
public double O1, O2, O3;
|
||||||
|
|
||||||
|
public Vector3 transformation = new Vector3(0, 0, 0);
|
||||||
|
|
||||||
|
static float temp = 2;
|
||||||
|
|
||||||
void RL3()
|
void RL3()
|
||||||
{
|
{
|
||||||
if ((X == 0) && (Z == 0))
|
if ((X == 0) && (Z == 0))
|
||||||
@@ -34,6 +38,9 @@ public class Foot : Component
|
|||||||
|
|
||||||
if (X < 0)
|
if (X < 0)
|
||||||
l3 = l3 * -1;
|
l3 = l3 * -1;
|
||||||
|
|
||||||
|
//todo
|
||||||
|
l3 -= temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
double FO1()
|
double FO1()
|
||||||
@@ -55,7 +62,12 @@ public class Foot : Component
|
|||||||
double y2 = Y * Y;
|
double y2 = Y * Y;
|
||||||
double z2 = Z * Z;
|
double z2 = Z * Z;
|
||||||
|
|
||||||
s = Math.Sqrt(x2 + y2 + z2);
|
double t = Math.Sqrt(x2 + z2);
|
||||||
|
t -= temp;
|
||||||
|
t = t * t;
|
||||||
|
//todo: X,Z remove distance temp.
|
||||||
|
s = Math.Sqrt(y2 + t);
|
||||||
|
//s = Math.Sqrt(x2 + y2 + z2);
|
||||||
|
|
||||||
double t1 = 0;
|
double t1 = 0;
|
||||||
double s2 = s * s;
|
double s2 = s * s;
|
||||||
@@ -127,6 +139,10 @@ public class Foot : Component
|
|||||||
Y += translateY;
|
Y += translateY;
|
||||||
Z += translateZ;
|
Z += translateZ;
|
||||||
|
|
||||||
|
X -= transformation.x;
|
||||||
|
Y -= transformation.y;
|
||||||
|
Z -= transformation.z;
|
||||||
|
|
||||||
/*RotateX();
|
/*RotateX();
|
||||||
RotateY();
|
RotateY();
|
||||||
RotateZ();*/
|
RotateZ();*/
|
||||||
@@ -153,7 +169,11 @@ public class Foot : Component
|
|||||||
Z = tx * -1;
|
Z = tx * -1;
|
||||||
|
|
||||||
// run IK
|
// run IK
|
||||||
|
// add adjustment from knie
|
||||||
|
|
||||||
O1 = (90 - FO1());
|
O1 = (90 - FO1());
|
||||||
|
// remove adjustment from knie
|
||||||
|
|
||||||
O2 = T1();
|
O2 = T1();
|
||||||
O3 = 180 - T3();
|
O3 = 180 - T3();
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ public class Leg : MonoBehaviour {
|
|||||||
public Vector3 point = new Vector3(10, 10, 0);
|
public Vector3 point = new Vector3(10, 10, 0);
|
||||||
public Quaternion rotation = new Quaternion(0, 0, 0, 0);
|
public Quaternion rotation = new Quaternion(0, 0, 0, 0);
|
||||||
|
|
||||||
|
public Vector3 transformation = new Vector3(0, 0, 0);
|
||||||
|
|
||||||
public bool invert = false;
|
public bool invert = false;
|
||||||
|
|
||||||
public double translateX = 0;
|
public double translateX = 0;
|
||||||
@@ -45,6 +47,8 @@ public class Leg : MonoBehaviour {
|
|||||||
foot.translateY = translateY;
|
foot.translateY = translateY;
|
||||||
foot.translateZ = translateZ;
|
foot.translateZ = translateZ;
|
||||||
|
|
||||||
|
foot.transformation = transformation;
|
||||||
|
|
||||||
foot.invert = invert;
|
foot.invert = invert;
|
||||||
|
|
||||||
foot.setleg();
|
foot.setleg();
|
||||||
|
|||||||
+2
-1
@@ -1834,7 +1834,7 @@ MeshRenderer:
|
|||||||
m_LightProbeUsage: 1
|
m_LightProbeUsage: 1
|
||||||
m_ReflectionProbeUsage: 1
|
m_ReflectionProbeUsage: 1
|
||||||
m_Materials:
|
m_Materials:
|
||||||
- {fileID: 10756, guid: 0000000000000000e000000000000000, type: 0}
|
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
m_StaticBatchInfo:
|
m_StaticBatchInfo:
|
||||||
firstSubMesh: 0
|
firstSubMesh: 0
|
||||||
subMeshCount: 0
|
subMeshCount: 0
|
||||||
@@ -3050,6 +3050,7 @@ MonoBehaviour:
|
|||||||
a3: 0
|
a3: 0
|
||||||
point: {x: 10, y: 10, z: 0}
|
point: {x: 10, y: 10, z: 0}
|
||||||
rotation: {x: 0, y: 0, z: 0, w: 0}
|
rotation: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
transformation: {x: 0, y: 0, z: 0}
|
||||||
invert: 0
|
invert: 0
|
||||||
translateX: 5
|
translateX: 5
|
||||||
translateY: 0
|
translateY: 0
|
||||||
|
|||||||
+13
-6
@@ -34421,6 +34421,7 @@ MonoBehaviour:
|
|||||||
a3: 0
|
a3: 0
|
||||||
point: {x: 4, y: -10, z: -13}
|
point: {x: 4, y: -10, z: -13}
|
||||||
rotation: {x: 0, y: 0, z: 0, w: 0}
|
rotation: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
transformation: {x: 0, y: 0, z: 0}
|
||||||
invert: 1
|
invert: 1
|
||||||
translateX: 5
|
translateX: 5
|
||||||
translateY: 0
|
translateY: 0
|
||||||
@@ -48734,6 +48735,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 30ea8dc0510444c42ae4b4db1f5ee2bd, type: 3}
|
m_Script: {fileID: 11500000, guid: 30ea8dc0510444c42ae4b4db1f5ee2bd, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
transformation: {x: 0, y: 0, z: 0}
|
||||||
rotation: {x: 0, y: 0, z: 0, w: 0}
|
rotation: {x: 0, y: 0, z: 0, w: 0}
|
||||||
rotation2:
|
rotation2:
|
||||||
- {fileID: 636309705}
|
- {fileID: 636309705}
|
||||||
@@ -54484,7 +54486,7 @@ Transform:
|
|||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 349087549}
|
m_GameObject: {fileID: 349087549}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 2}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 526007731}
|
- {fileID: 526007731}
|
||||||
@@ -92879,6 +92881,7 @@ MonoBehaviour:
|
|||||||
a3: 0
|
a3: 0
|
||||||
point: {x: 0, y: -10, z: 15}
|
point: {x: 0, y: -10, z: 15}
|
||||||
rotation: {x: 0, y: 0, z: 0, w: 0}
|
rotation: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
transformation: {x: 0, y: 0, z: 0}
|
||||||
invert: 0
|
invert: 0
|
||||||
translateX: 0
|
translateX: 0
|
||||||
translateY: 0
|
translateY: 0
|
||||||
@@ -99400,6 +99403,7 @@ MonoBehaviour:
|
|||||||
a3: 0
|
a3: 0
|
||||||
point: {x: -4, y: -10, z: 13}
|
point: {x: -4, y: -10, z: 13}
|
||||||
rotation: {x: 0, y: 0, z: 0, w: 0}
|
rotation: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
transformation: {x: 0, y: 0, z: 0}
|
||||||
invert: 0
|
invert: 0
|
||||||
translateX: -5
|
translateX: -5
|
||||||
translateY: 0
|
translateY: 0
|
||||||
@@ -138777,7 +138781,7 @@ Transform:
|
|||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 866778528}
|
m_GameObject: {fileID: 866778528}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 2}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 246942919}
|
- {fileID: 246942919}
|
||||||
@@ -157414,7 +157418,7 @@ Transform:
|
|||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 986205296}
|
m_GameObject: {fileID: 986205296}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 2}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 1248951963}
|
- {fileID: 1248951963}
|
||||||
@@ -234724,6 +234728,7 @@ MonoBehaviour:
|
|||||||
a3: 0
|
a3: 0
|
||||||
point: {x: -4, y: -10, z: -13}
|
point: {x: -4, y: -10, z: -13}
|
||||||
rotation: {x: 0, y: 0, z: 0, w: 0}
|
rotation: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
transformation: {x: 0, y: 0, z: 0}
|
||||||
invert: 1
|
invert: 1
|
||||||
translateX: -5
|
translateX: -5
|
||||||
translateY: 0
|
translateY: 0
|
||||||
@@ -252249,7 +252254,7 @@ Transform:
|
|||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1573589440}
|
m_GameObject: {fileID: 1573589440}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 2}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 952427227}
|
- {fileID: 952427227}
|
||||||
@@ -259155,6 +259160,7 @@ MonoBehaviour:
|
|||||||
a3: 0
|
a3: 0
|
||||||
point: {x: 4, y: -10, z: 13}
|
point: {x: 4, y: -10, z: 13}
|
||||||
rotation: {x: 0, y: 0, z: 0, w: 0}
|
rotation: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
transformation: {x: 0, y: 0, z: 0}
|
||||||
invert: 0
|
invert: 0
|
||||||
translateX: 5
|
translateX: 5
|
||||||
translateY: 0
|
translateY: 0
|
||||||
@@ -283853,6 +283859,7 @@ MonoBehaviour:
|
|||||||
a3: 0
|
a3: 0
|
||||||
point: {x: 0, y: -10, z: -15}
|
point: {x: 0, y: -10, z: -15}
|
||||||
rotation: {x: 0, y: 0, z: 0, w: 0}
|
rotation: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
transformation: {x: 0, y: 0, z: 0}
|
||||||
invert: 1
|
invert: 1
|
||||||
translateX: 0
|
translateX: 0
|
||||||
translateY: 0
|
translateY: 0
|
||||||
@@ -290809,7 +290816,7 @@ Transform:
|
|||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1813824933}
|
m_GameObject: {fileID: 1813824933}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 2}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 1534966623}
|
- {fileID: 1534966623}
|
||||||
@@ -305949,7 +305956,7 @@ Transform:
|
|||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1902568238}
|
m_GameObject: {fileID: 1902568238}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 2}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 1164689000}
|
- {fileID: 1164689000}
|
||||||
|
|||||||
Reference in New Issue
Block a user