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

@@ -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)