Fix NaN and tweak colliders

This commit is contained in:
Jens Pitkänen 2020-08-10 01:16:06 +03:00
parent 0430badc00
commit 5fd67e0c6a
3 changed files with 24 additions and 52 deletions

View File

@ -757,14 +757,6 @@ PrefabInstance:
propertyPath: m_Layer
value: 10
objectReference: {fileID: 0}
- target: {fileID: 7931246460515997121, guid: 0bffd92c46c257840806f5e957954800, type: 3}
propertyPath: m_Controller
value:
objectReference: {fileID: 9100000, guid: 143e6d49c5bcf64459b414767d2b4dab, type: 2}
- target: {fileID: 7931246460515997121, guid: 0bffd92c46c257840806f5e957954800, type: 3}
propertyPath: m_ApplyRootMotion
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8048983936687622071, guid: 0bffd92c46c257840806f5e957954800, type: 3}
propertyPath: m_Layer
value: 10
@ -785,14 +777,6 @@ PrefabInstance:
propertyPath: m_Layer
value: 10
objectReference: {fileID: 0}
- target: {fileID: 8380320334439546530, guid: 0bffd92c46c257840806f5e957954800, type: 3}
propertyPath: m_Controller
value:
objectReference: {fileID: 9100000, guid: 143e6d49c5bcf64459b414767d2b4dab, type: 2}
- target: {fileID: 8380320334439546530, guid: 0bffd92c46c257840806f5e957954800, type: 3}
propertyPath: m_ApplyRootMotion
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8393781323051440261, guid: 0bffd92c46c257840806f5e957954800, type: 3}
propertyPath: GunGluedToHand
value: 0

View File

@ -160,7 +160,6 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 1865991757674780053}
- component: {fileID: 4825183178267082914}
m_Layer: 0
m_Name: Gun
m_TagString: Untagged
@ -184,19 +183,6 @@ Transform:
m_Father: {fileID: 4833458671639168932}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4825183178267082914
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2071588178488902664}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c0e8b530a9e9275419a275e5557a0420, type: 3}
m_Name:
m_EditorClassIdentifier:
Speed: 10
--- !u!1 &6951373490603822597
GameObject:
m_ObjectHideFlags: 0
@ -396,8 +382,8 @@ BoxCollider:
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.6, y: 1.4, z: 0.6}
m_Center: {x: 0, y: 0.7, z: 0}
m_Size: {x: 0.6, y: 1.7, z: 0.6}
m_Center: {x: 0, y: 0.85, z: 0}
--- !u!1 &7391558912774766599
GameObject:
m_ObjectHideFlags: 0
@ -485,7 +471,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
CoyoteTime: 0.2
PingBias: 0
MovementUpdateInterval: 0.03
MoveStyles:
- {fileID: 11400000, guid: 550df8ac62d76a64a8c621ea6b32398f, type: 2}
- {fileID: 11400000, guid: 2d9739d3745581a41ae0ed6a569766d5, type: 2}
@ -501,7 +486,6 @@ MonoBehaviour:
m_Bits: 823
Cooldown: 1
Lerpables:
- {fileID: 4825183178267082914}
- {fileID: 6585337033203946896}
Lean: 0
LaserPrefab: {fileID: 8009551885746485900, guid: 5c99da0361d098646b319a35fcc80095, type: 3}
@ -551,13 +535,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7391558913556166741}
m_LocalRotation: {x: 0.14167397, y: -0, z: -0, w: 0.9899134}
m_LocalPosition: {x: 0, y: 1.647, z: 0.144}
m_LocalRotation: {x: -0.16313043, y: -0, z: -0, w: 0.9866046}
m_LocalPosition: {x: 0, y: 1.86, z: -0.16}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7391558912774766616}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 16.289, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: -18.777, y: 0, z: 0}
--- !u!65 &7391558913556166743
BoxCollider:
m_ObjectHideFlags: 0
@ -569,7 +553,7 @@ BoxCollider:
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.5, y: 0.5, z: 0.5}
m_Size: {x: 0.4, y: 0.35, z: 0.4}
m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &8480591234863426618
GameObject:
@ -866,7 +850,11 @@ PrefabInstance:
- target: {fileID: 5866666021909216657, guid: e18005d630710ec40b4e791ef3ee97c7, type: 3}
propertyPath: m_Controller
value:
objectReference: {fileID: 9100000, guid: 9917118805dd64449bd5bc1b9d284eff, type: 2}
objectReference: {fileID: 9100000, guid: 143e6d49c5bcf64459b414767d2b4dab, type: 2}
- target: {fileID: 5866666021909216657, guid: e18005d630710ec40b4e791ef3ee97c7, type: 3}
propertyPath: m_ApplyRootMotion
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e18005d630710ec40b4e791ef3ee97c7, type: 3}
--- !u!95 &8380320334439546530 stripped
@ -949,7 +937,11 @@ PrefabInstance:
- target: {fileID: 5866666021909216657, guid: bb45094e64c7170458884eea0a4f4c68, type: 3}
propertyPath: m_Controller
value:
objectReference: {fileID: 9100000, guid: 9917118805dd64449bd5bc1b9d284eff, type: 2}
objectReference: {fileID: 9100000, guid: 143e6d49c5bcf64459b414767d2b4dab, type: 2}
- target: {fileID: 5866666021909216657, guid: bb45094e64c7170458884eea0a4f4c68, type: 3}
propertyPath: m_ApplyRootMotion
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: bb45094e64c7170458884eea0a4f4c68, type: 3}
--- !u!95 &7931246460515997121 stripped

View File

@ -31,23 +31,19 @@ namespace NeonTea.Quakeball.Animation {
}
Animator = Soldiers[(int)Model].GetComponent<Animator>();
Animator.gameObject.SetActive(true);
Transform Head = TransformUtil.FindChildWithName(Animator.transform, "HEAD");
HeadCollider.parent = Head;
HeadCollider.parent = TransformUtil.FindChildWithName(Animator.transform, "HEAD");
BehindHand = TransformUtil.FindChildWithName(Animator.transform, "HAND.R");
FrontHand = TransformUtil.FindChildWithName(Animator.transform, "HAND.L");
if (GunGluedToHand) {
Gun.parent = Animator.transform;
}
}
private void Update() {
float Right = Vector3.Dot(Player.GroundVelocity.normalized, transform.right);
float Forward = Vector3.Dot(Player.GroundVelocity.normalized, transform.forward);
float RelativeSpeed = Player.GroundVelocity.magnitude / Player.MoveStyle.TargetVelocity;
Right = Mathf.Clamp(Right * RelativeSpeed, -0.999f, 0.999f);
Forward = Mathf.Clamp(Forward * RelativeSpeed, -.999f, 0.999f);
// Square the circle:
Forward = 0.5f * Mathf.Sqrt(2 - Right * Right + Forward * Forward + 2 * Forward * Mathf.Sqrt(2)) - 0.5f * Mathf.Sqrt(2 - Right * Right + Forward * Forward - 2 * Forward * Mathf.Sqrt(2));
Right = 0.5f * Mathf.Sqrt(2 + Right * Right - Forward * Forward + 2 * Right * Mathf.Sqrt(2)) - 0.5f * Mathf.Sqrt(2 + Right * Right - Forward * Forward - 2 * Right * Mathf.Sqrt(2));
Animator.SetFloat("Forward", Forward);
Animator.SetFloat("Right", Right);
float Right = Vector3.Dot(Player.GroundVelocity, transform.right) / Player.MoveStyle.TargetVelocity / 0.7f;
float Forward = Vector3.Dot(Player.GroundVelocity, transform.forward) / Player.MoveStyle.TargetVelocity / 0.7f;
Animator.SetFloat("Forward", Mathf.Clamp(Forward, -1, 1));
Animator.SetFloat("Right", Mathf.Clamp(Right, -1, 1));
}
private void LateUpdate() {