- Home /
Creation of a door with collision for a FirstPerson game
I'm currently trying to create a door for a First Person type game. So far I did the following:
created a model in Blender
rigged the door mesh to an armature with a single bone
created two animations (close and open)
created a lowpoly mesh for collision
After importing the door into Unity I'm quite confused about the different options. For example I'm not sure which Animation Type I should use (currently I'm playing with Legacy). Furthermore I'm not sure about the best practice to add the collision mesh to the door which has been setup with a Skinned mesh renderer and no collision by default. Both animations work fine however.
Is there any best practice for the creation pipeline of animated doors or other animated assets with collision meshes? I don't want to use hinge joints for the door by the way. Thanks for your help.
Why deal with the pains of animating and just do it in Unity?
Animating a door is rather simple in my opinion. At least if you compare it to animating humanoid characters :D
By "doing it in Unity" you probably mean rotating the door by script? That would be easy but I intended to have more detailed doors later e.g. with moving handles, sliding locks and so on.
You don't necessarily have to use the collider that's already on your door to setup the collision detection. You may also want to consider using the Function OnTriggerEnter.
I believe it best that your doorhandle, etc. should be animated on your model, but the actual rotation of the door be handled by Unity. Why? Because Unity will not change the collider based on the animation, if I'm correct, but it will if it's the one rotating the door. As far as triggering it to open, make a sphere collider as a trigger, when the player enters it, begin listening for your desired keypress, and let Unity rotate it when the key is pressed.