|
@@ -108,7 +108,8 @@ public class PuckController : MonoBehaviour
|
|
|
|
|
|
|
|
transform.position = targetCarryPosition;
|
|
transform.position = targetCarryPosition;
|
|
|
|
|
|
|
|
- if (rb != null)
|
|
|
|
|
|
|
+ // Only set velocities if NOT kinematic
|
|
|
|
|
+ if (rb != null && !rb.isKinematic)
|
|
|
{
|
|
{
|
|
|
rb.linearVelocity = Vector3.zero;
|
|
rb.linearVelocity = Vector3.zero;
|
|
|
rb.angularVelocity = Vector3.zero;
|
|
rb.angularVelocity = Vector3.zero;
|
|
@@ -129,7 +130,7 @@ public class PuckController : MonoBehaviour
|
|
|
pos.y = 0.025f;
|
|
pos.y = 0.025f;
|
|
|
transform.position = pos;
|
|
transform.position = pos;
|
|
|
|
|
|
|
|
- if (rb != null)
|
|
|
|
|
|
|
+ if (rb != null && !rb.isKinematic)
|
|
|
{
|
|
{
|
|
|
Vector3 vel = rb.linearVelocity;
|
|
Vector3 vel = rb.linearVelocity;
|
|
|
if (vel.y < 0)
|
|
if (vel.y < 0)
|
|
@@ -202,21 +203,28 @@ public class PuckController : MonoBehaviour
|
|
|
|
|
|
|
|
currentCarrier = player;
|
|
currentCarrier = player;
|
|
|
isBeingCarried = true;
|
|
isBeingCarried = true;
|
|
|
|
|
+ isPassActive = false; // Stop pass when picked up
|
|
|
|
|
|
|
|
if (player != null)
|
|
if (player != null)
|
|
|
{
|
|
{
|
|
|
// IMPORTANT: Stop all physics movement immediately
|
|
// IMPORTANT: Stop all physics movement immediately
|
|
|
if (rb != null)
|
|
if (rb != null)
|
|
|
{
|
|
{
|
|
|
- rb.linearVelocity = Vector3.zero;
|
|
|
|
|
- rb.angularVelocity = Vector3.zero;
|
|
|
|
|
- rb.isKinematic = true; // Make kinematic while carried
|
|
|
|
|
|
|
+ // Stop velocities BEFORE making kinematic
|
|
|
|
|
+ if (!rb.isKinematic)
|
|
|
|
|
+ {
|
|
|
|
|
+ rb.linearVelocity = Vector3.zero;
|
|
|
|
|
+ rb.angularVelocity = Vector3.zero;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Now make kinematic
|
|
|
|
|
+ rb.isKinematic = true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Position puck at player's feet immediately to prevent bouncing
|
|
// Position puck at player's feet immediately to prevent bouncing
|
|
|
Vector3 playerForward = player.transform.forward;
|
|
Vector3 playerForward = player.transform.forward;
|
|
|
Vector3 targetPos = player.transform.position + playerForward * carrierOffset;
|
|
Vector3 targetPos = player.transform.position + playerForward * carrierOffset;
|
|
|
- targetPos.y = 0.025f; // Puck height
|
|
|
|
|
|
|
+ targetPos.y = 0.025f;
|
|
|
transform.position = targetPos;
|
|
transform.position = targetPos;
|
|
|
|
|
|
|
|
player.GainPuck(this);
|
|
player.GainPuck(this);
|
|
@@ -235,9 +243,10 @@ public class PuckController : MonoBehaviour
|
|
|
isBeingCarried = false;
|
|
isBeingCarried = false;
|
|
|
|
|
|
|
|
// Re-enable physics
|
|
// Re-enable physics
|
|
|
- if (rb != null)
|
|
|
|
|
|
|
+ if (rb != null && rb.isKinematic)
|
|
|
{
|
|
{
|
|
|
rb.isKinematic = false;
|
|
rb.isKinematic = false;
|
|
|
|
|
+ // Velocities will be set by ApplyForce or naturally by physics
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
UpdateVisualState(false);
|
|
UpdateVisualState(false);
|