Skip to content

Commit

Permalink
fix: slime cannot push boxes with probability 1 rather than 1/2
Browse files Browse the repository at this point in the history
  • Loading branch information
gjwj5505 committed Dec 17, 2024
1 parent 3737f80 commit eecb26d
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Assets/SWPPT3/Scripts/Main/PlayerLogic/PlayerMover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ public class PlayerMover : MonoBehaviour
private bool isRightButton = false;
private bool _isHoldingJump;

private int _rigidBodyId;

private void Start()
{
_rigidBodyId = _rb.GetInstanceID();
_moveSpeed = _playerScript.MoveSpeed;
_rotationSpeed = _playerScript.RotationSpeed;
_jumpForce = _playerScript.JumpForce * _rb.mass;
Expand Down Expand Up @@ -81,13 +84,18 @@ public void ModificationEvent(PhysicsScene scene, NativeArray<ModifiableContactP
for (int i = 0; i < pairs.Length; i++)
{
var pair = pairs[i];

var properties = pair.massProperties;

properties.inverseMassScale = 1f;
properties.inverseInertiaScale = 1f;
properties.otherInverseMassScale = 0;
properties.otherInverseInertiaScale = 0;
if(_rigidBodyId == pair.bodyInstanceID)
{
properties.otherInverseMassScale = 0f;
properties.otherInverseInertiaScale = 0f;
}
if(_rigidBodyId == pair.otherBodyInstanceID)
{
properties.inverseMassScale = 0f;
properties.inverseInertiaScale = 0f;
}

pair.massProperties = properties;

Expand Down

0 comments on commit eecb26d

Please sign in to comment.