I m trying to detect the collision of two objects (Player and Rock) I want to be able to handle the collision event (OnTriggerEnter) but also prevent the objects from intersecting.
- the player runs into the rock,
- the rock knows its the player (OnTriggerEnter or similar)
- The player cannot move through the rock, stops right at it’s edge as if trying to walk through a wall
- The rock does not move
I have tried all variations of Is Trigger, Is Kinematic and both objects have rigid bodies attached but the closest I get is one of the objects spinning off into the abyss. I have even tried using OnTriggerEnter and OnTriggerStay to set the position of the player to the position it was at when the collision first occurred which works but looks like ass.
How can I detect the collision in my script but keep both objects from driving over/through each other?
Thank you very much for any help!