- Home /
Rigidbody collision/interaction
What I am trying to do is simply allow for the interaction between player (FPSController) and a barrel mesh I have created.
I stack the barrels up and then the player can walk into them, interacting and colliding with the barrels, knocking them over.
I have applied rigidbody colliders and mesh collision to the barrels and they fall and hit each other but they aren't actually effected by the player, though he does collide with them, just no movement.
I have not a clue how to go about doing this and any help would be greatly appreciated.
What is your player? Is the player another rigidbody, or is it a CharacterController or a static collider using transform.Translate for movement?
Answer by syclamoth · Nov 12, 2011 at 04:15 AM
What is your player? Is the player another rigidbody, or is it a CharacterController or a static collider using transform.Translate for movement? Static colliders won't cut it here- you should at least use a kinematic Rigidbody here. The best way is to make the player a non-kinematic rigidbody (preforably with freezeRotation on so that you don't roll everywhere) so that it can interact with other rigidbodies properly.
Answer by Owen-Reynolds · Nov 12, 2011 at 03:21 PM
FPScontroller is the one that uses controller.Move(moveDirection)
using a charController, right? CharConts purposely do not push or even hit other objects. They sort of see that they would hit something, not in the physics engine, and slide around before technically colliding.
The special http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.OnControllerColliderHit.html was created for this. That page has an example of how to "build" a push. Since it's code, you can tweak/redo it all you like (for example, to push away from you instead of directly forwards.)
All this messing around is why I don't use CharacterControllers. They're useful for exactly one thing, and if you want to do anything else with them it's much quicker and easier to write your own...
Your answer
Follow this Question
Related Questions
Parent Object 0 Answers
Collision Detection When Picking Up GameObjects 1 Answer
Player colliding with pickable object 0 Answers
Player goes straight through cube 1 Answer