Rigidbody can push but can't be pushed
I've set up a rigidbody-based first-person controller which can walk into and push other rigidbodies. The problem is that the collision also inversely affects the player object. For example, walking into a sphere not only slows down the player, but they can sometimes walk up on top of it with their capsule collider. Is there a way to create a one-way relationship between collisions so the player can move other objects but they don't move the player?
Answer by eses · Aug 23, 2018 at 01:31 PM
Hi @CASandberg - One solution is to use kinematic rigidbodies, but then you'll have other issues to figure out - but at least your rb is not affected by other rb's.
See manual:
https://docs.unity3d.com/ScriptReference/Rigidbody-isKinematic.html
Answer by basil3 · Aug 23, 2018 at 02:14 PM
How about using rigidbody.addforce?
https://unity3d.com/learn/tutorials/topics/physics/adding-physics-forces
You could use the colliders to detect when the first person controller touches the gameobject you want to push and then use add force to move the game object in a direction your player is facing.
Ste
Your answer
Follow this Question
Related Questions
Ball Speed is not increasing as per code 0 Answers
Making a rigidbody "immune" to reacting with another specific rigidbody? 0 Answers
Player Movement Goes Crazy When Hit On Side Of Moving Platform 0 Answers
Player moves indefinitely after collision 0 Answers
Rigidbody falling not according to physics, only when script is applied. 0 Answers