fix: strange raction with head, and bigger pressure plate

This commit is contained in:
timote koenig
2026-03-12 16:55:03 +01:00
parent 08b051de1c
commit e506bce879
7 changed files with 13599 additions and 4065 deletions

View File

@@ -2,7 +2,7 @@
- Project name: HeadlessHazard
- Unity version: Unity 6000.3.10f1
- Active game object:
- Name: Head
- Tag: Player
- Layer: Default
- Name: TileFloor
- Tag: Ground
- Layer: Ground
<!-- UNITY CODE ASSIST INSTRUCTIONS END -->

View File

@@ -5,10 +5,12 @@ public class PlayerHeadController : MonoBehaviour
public Transform Head;
public Transform CameraTransform;
public float ThrowForce = 10f;
public float PickupDistance = 3f;
public Transform BodyTransform;
public bool isHoldingHead = true;
public float ThrowForce;
public float PickupDistance;
public bool isHoldingHead;
private Rigidbody m_headRigidbody;
@@ -28,8 +30,13 @@ public class PlayerHeadController : MonoBehaviour
{
Cursor.lockState = CursorLockMode.Locked;
m_headInitialLocalPos = Head.localPosition;
m_headInitialLocalRot = Head.localRotation;
Vector3 offset = new Vector3(0f, -0.5f, 0.5f);
m_headInitialLocalPos = BodyTransform.localPosition + offset;
m_headInitialLocalRot = BodyTransform.localRotation;
m_headRigidbody = Head.GetComponent<Rigidbody>();
Head.SetParent(null);
}
void Update()
@@ -55,6 +62,7 @@ public class PlayerHeadController : MonoBehaviour
private void DropHead()
{
Debug.Log("DropHead");
animator.SetTrigger("Throw");
isHoldingHead = false;
@@ -72,6 +80,7 @@ public class PlayerHeadController : MonoBehaviour
private void ThrowHead()
{
Debug.Log("ThrowHead");
if (!isHoldingHead)
return;
@@ -95,6 +104,7 @@ public class PlayerHeadController : MonoBehaviour
private void PickupHead()
{
Debug.Log("PickupHead");
isHoldingHead = true;
if (m_headRigidbody != null)

View File

@@ -113,31 +113,31 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 8300425658720571131, guid: 8ae6d0072edd3ef6a8e8fab748ba5098, type: 3}
propertyPath: m_LocalPosition.x
value: 0
value: 0.165
objectReference: {fileID: 0}
- target: {fileID: 8300425658720571131, guid: 8ae6d0072edd3ef6a8e8fab748ba5098, type: 3}
propertyPath: m_LocalPosition.y
value: -0.421
value: -0.36
objectReference: {fileID: 0}
- target: {fileID: 8300425658720571131, guid: 8ae6d0072edd3ef6a8e8fab748ba5098, type: 3}
propertyPath: m_LocalPosition.z
value: 0.475
value: 3.94
objectReference: {fileID: 0}
- target: {fileID: 8300425658720571131, guid: 8ae6d0072edd3ef6a8e8fab748ba5098, type: 3}
propertyPath: m_LocalRotation.w
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8300425658720571131, guid: 8ae6d0072edd3ef6a8e8fab748ba5098, type: 3}
propertyPath: m_LocalRotation.x
value: -0
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8300425658720571131, guid: 8ae6d0072edd3ef6a8e8fab748ba5098, type: 3}
propertyPath: m_LocalRotation.y
value: -0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8300425658720571131, guid: 8ae6d0072edd3ef6a8e8fab748ba5098, type: 3}
propertyPath: m_LocalRotation.z
value: -0
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8300425658720571131, guid: 8ae6d0072edd3ef6a8e8fab748ba5098, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@@ -145,7 +145,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 8300425658720571131, guid: 8ae6d0072edd3ef6a8e8fab748ba5098, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
value: 180
objectReference: {fileID: 0}
- target: {fileID: 8300425658720571131, guid: 8ae6d0072edd3ef6a8e8fab748ba5098, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
@@ -159,6 +159,9 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 4513738306462009106, guid: 8ae6d0072edd3ef6a8e8fab748ba5098, type: 3}
insertIndex: -1
addedObject: {fileID: 6096268390463610501}
- targetCorrespondingSourceObject: {fileID: 4513738306462009106, guid: 8ae6d0072edd3ef6a8e8fab748ba5098, type: 3}
insertIndex: -1
addedObject: {fileID: 5755554930316629681}
m_SourcePrefab: {fileID: 100100000, guid: 8ae6d0072edd3ef6a8e8fab748ba5098, type: 3}
--- !u!1 &4446703388580953019 stripped
GameObject:
@@ -184,8 +187,35 @@ BoxCollider:
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 0.79742086, y: 0.5844476, z: 0.75984764}
m_Center: {x: -0.0018145442, y: 1.2922238, z: 0.060781002}
m_Size: {x: 0.66390085, y: 0.5504439, z: 0.7120738}
m_Center: {x: -0.0021908283, y: 1.2829982, z: 0.08466792}
--- !u!54 &5755554930316629681
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4446703388580953019}
serializedVersion: 5
m_Mass: 1
m_LinearDamping: 0
m_AngularDamping: 0.05
m_CenterOfMass: {x: 0, y: 0, z: 0}
m_InertiaTensor: {x: 1, y: 1, z: 1}
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_ImplicitCom: 1
m_ImplicitTensor: 1
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 112
m_CollisionDetection: 0
--- !u!4 &8079687630579216978 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 8300425658720571131, guid: 8ae6d0072edd3ef6a8e8fab748ba5098, type: 3}
@@ -208,6 +238,10 @@ PrefabInstance:
propertyPath: m_Name
value: Body
objectReference: {fileID: 0}
- target: {fileID: 8848088476524540231, guid: 459ef74c4ee79d3eb8e1ba6a0f06c9a7, type: 3}
propertyPath: m_LocalScale.z
value: 1.5
objectReference: {fileID: 0}
- target: {fileID: 8848088476524540231, guid: 459ef74c4ee79d3eb8e1ba6a0f06c9a7, type: 3}
propertyPath: m_LocalPosition.x
value: 0
@@ -226,15 +260,15 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 8848088476524540231, guid: 459ef74c4ee79d3eb8e1ba6a0f06c9a7, type: 3}
propertyPath: m_LocalRotation.x
value: -0
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8848088476524540231, guid: 459ef74c4ee79d3eb8e1ba6a0f06c9a7, type: 3}
propertyPath: m_LocalRotation.y
value: -0
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8848088476524540231, guid: 459ef74c4ee79d3eb8e1ba6a0f06c9a7, type: 3}
propertyPath: m_LocalRotation.z
value: -0
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8848088476524540231, guid: 459ef74c4ee79d3eb8e1ba6a0f06c9a7, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@@ -564,21 +598,33 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
propertyPath: m_LocalScale.x
value: 4
objectReference: {fileID: 0}
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
propertyPath: m_LocalScale.y
value: 4
objectReference: {fileID: 0}
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
propertyPath: m_LocalScale.z
value: 4
objectReference: {fileID: 0}
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
propertyPath: m_LocalPosition.x
value: 0
value: -30.76
objectReference: {fileID: 0}
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
propertyPath: m_LocalPosition.y
value: 0.5
value: -0.00000057122224
objectReference: {fileID: 0}
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
propertyPath: m_LocalPosition.z
value: 0
value: -7.51
objectReference: {fileID: 0}
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
propertyPath: m_LocalRotation.w
value: 0.7071068
value: 1
objectReference: {fileID: 0}
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
propertyPath: m_LocalRotation.x
@@ -586,7 +632,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
propertyPath: m_LocalRotation.y
value: 0.7071068
value: 0
objectReference: {fileID: 0}
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
propertyPath: m_LocalRotation.z
@@ -598,7 +644,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 90
value: 0
objectReference: {fileID: 0}
- target: {fileID: -4216859302048453862, guid: 82a2914d8f86c62488456950c8330e38, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
@@ -958,7 +1004,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7f91586e8c2742341aa8f6925e597bf1, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::PlayerMovement
WalkSpeed: 7.5
WalkSpeed: 10
rotationSpeed: 10
animator: {fileID: 144211389547005650}
cameraTransform: {fileID: 8258725777112540271}
@@ -976,9 +1022,10 @@ MonoBehaviour:
m_EditorClassIdentifier: Assembly-CSharp::PlayerHeadController
Head: {fileID: 8079687630579216978}
CameraTransform: {fileID: 8258725777112540271}
ThrowForce: 10
PickupDistance: 3
isHoldingHead: 1
BodyTransform: {fileID: 6975610370707183838}
ThrowForce: 20
PickupDistance: 10
isHoldingHead: 0
--- !u!114 &2936940972087595065
MonoBehaviour:
m_ObjectHideFlags: 0

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e432ef0440d877645a18c87cd2c11379
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

View File

@@ -74,23 +74,13 @@
{
"type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.LastSize.Cube",
"value": "{\"m_Value\":{\"x\":4.0,\"y\":0.10000000149011612,\"z\":5.0}}"
"value": "{\"m_Value\":{\"x\":0.10000000149011612,\"y\":2.0,\"z\":1.0}}"
},
{
"type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.LastSize.Sphere",
"value": "{\"m_Value\":{\"x\":0.5,\"y\":0.5,\"z\":0.5}}"
},
{
"type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.LastSize.Door",
"value": "{\"m_Value\":{\"x\":10.0,\"y\":5.0,\"z\":0.10000000149011612}}"
},
{
"type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.LastSize.Arch",
"value": "{\"m_Value\":{\"x\":10.0,\"y\":0.10000000149011612,\"z\":10.0}}"
},
{
"type": "UnityEngine.Quaternion, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.LastRotation.Cube",
@@ -101,16 +91,6 @@
"key": "ShapeBuilder.LastRotation.Sphere",
"value": "{\"m_Value\":{\"x\":0.0,\"y\":0.0,\"z\":0.0,\"w\":1.0}}"
},
{
"type": "UnityEngine.Quaternion, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.LastRotation.Door",
"value": "{\"m_Value\":{\"x\":0.0,\"y\":0.0,\"z\":0.0,\"w\":1.0}}"
},
{
"type": "UnityEngine.Quaternion, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.LastRotation.Arch",
"value": "{\"m_Value\":{\"x\":0.0,\"y\":0.0,\"z\":0.0,\"w\":1.0}}"
},
{
"type": "UnityEngine.ProBuilder.PivotLocation, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.PivotLocation.Cube",
@@ -121,16 +101,6 @@
"key": "ShapeBuilder.PivotLocation.Sphere",
"value": "{\"m_Value\":0}"
},
{
"type": "UnityEngine.ProBuilder.PivotLocation, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.PivotLocation.Door",
"value": "{\"m_Value\":0}"
},
{
"type": "UnityEngine.ProBuilder.PivotLocation, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.PivotLocation.Arch",
"value": "{\"m_Value\":0}"
},
{
"type": "UnityEngine.ProBuilder.Shapes.Shape, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.Cube",
@@ -141,16 +111,6 @@
"key": "ShapeBuilder.Sphere",
"value": "{}"
},
{
"type": "UnityEngine.ProBuilder.Shapes.Shape, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.Door",
"value": "{}"
},
{
"type": "UnityEngine.ProBuilder.Shapes.Shape, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.Arch",
"value": "{}"
},
{
"type": "UnityEngine.Rendering.ShadowCastingMode, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "mesh.shadowCastingMode",