- Home /
Colliding with static model
I have a bunch of candle models and a player character model (with a character controller).
I do not want the character to pass through the candles and I also don't want the candles to move on collision. I'm not sure how to go about doing this. If I use Rigid Bodies for the candles with a mesh collider and freeze their position and rotation, the character passes through it. If I remove either of the freeze options, then the candle moves.
I have two colliders on the candle objects, a sphere collider (for lighting the candle) and a mesh collider (for the rigid body).
The isKinematic option is not checked as well.
Can someone please guide me?
Thanks, Raja
Answer by Bryan 4 · May 02, 2011 at 06:55 PM
Just add colliders to your static objects and do not have a rigid body attached. That will ensure they do not follow physics calculations and will be stationary objects that cannot be passed through.
Also make sure NOT to move those items with a collider and no rigidbody(static collider) as this is very expensive.
You can ensure they will not move by checking the Static checkbox on the gameobjects.
Ah, I think I'm doing something totally wrong here. I'm using a character controller for the player model and I move him by just updating the transform directly (i.e. i don't use move/simply$$anonymous$$ove). If I didn't make the candle a rigid body, I wouldn't be able to use the trigger/collision messages to "light" the candle.
So, now I'm totally confused. Does the character pass through the candle simply because I "update" the transform.position to move x units in the transform.forward direction? What is the simplest way to rectify the blunders I've made?
Yes the character passes through the candle because you are hard setting the transform.position. The easiest fix is to use the default character controller which modifies velocity on key press, or building your own with similiar functionality.
Your answer
Follow this Question
Related Questions
Checking and destroying a rigidbody? 2 Answers
This might be simple but i'm lost. 4 Answers
Problem with damaging game object 1 Answer
Problem with Static Variable? 1 Answer