- Home /
Having an FPS character collide push ragdolls.
I have an FPS controller, which so far works perfectly using triggers to detect colissions with bullets and the such.
But now I want my character to be able to push ragdolls and other objects in it's way.
I can't add a rigid body component to my controller, so I tried to attach a game object with it's own collision box and rigid body. It works to push doors, ragdolls and other gameobjects with rigid bodys.
I was thinking in maybe, just detecting when I collide with one of those objects and apply a force to their rigid bodies.
What's the best way to acomplish my objective ?
Answer by tertle · Feb 03, 2011 at 11:17 PM
I was thinking in maybe, just detecting when I collide with one of those objects and apply a force to their rigid bodies.
Seems like you're on the right track as I believe that's the easiest way to do it. Just apply a force in the same direction you were traveling onto the object.
OnControllerColliderHit Scrip Reference
Has an example how to do this as well. Note that it doesn't push in y direction but that can be change easier enough if you want that.
Obviously if you're using ragdolls might need to be a little more complex but it's a good starting point.
Your answer
Follow this Question
Related Questions
Have a "standing" character who responds to a hit like a ragdoll but never falls down 0 Answers
FPS Advance Gun Script 1 Answer
how to change scene using rigidbody 3 Answers
Gun Rotation Problem 1 Answer