|
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.
(comments are locked)
|
|
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.
(comments are locked)
|
|
FPScontroller is the one that uses 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...
Nov 13 '11 at 04:45 AM
syclamoth
Thank you Owen! This was EXACTLY what I needed!
Nov 13 '11 at 09:11 PM
Sitrane
(comments are locked)
|

What is your player? Is the player another rigidbody, or is it a CharacterController or a static collider using transform.Translate for movement?