- Home /
How to stop first person player from walking through animated door
Hi
I have a door which is animating (opening and closing) I have a first person character I walk toward the door The door close and the character walks straight through.
I understand that if they were both rigid bodies physics would correctly position them
Is there a way to parent them if they come into contact Or it is easier to add a rigid body component to the player which is activated only when they come into contact?
Answer by IJM · Oct 16, 2010 at 07:11 PM
There is really no need to use an animated model for doors. Move the center of the Y-axis,on the door model, far right/left and rotate the model around it from the script.
In general you are absolutly right, but think of a really complex door (best example as an old half-life player i could think of is a Combine-door) that isn't just turn around one axis, but is mounted on a kind of a robotarm. In such a case you would use an animated door but even in HL2 they placed a simple invisible "collider" inside the door that is opening or just disappearing when the door is open. That way the logical and visual function is separated.