I’m having a mesh that has one looped animation and it seems that when I add a MeshCollider to it, the MeshCollider keeps its original position/form…the MeshCollider isn’t animated.
How can I make my MeshCollider follow the animated mesh vertices ?
I use physics, so I can’t easily use the IsTrigger flag, 'cause it’ll make me write too much code I think…
You can’t, but even if you could, it would likely be very slow. Mesh colliders take a lot of heavy preprocessing to make, so it’s not practical to update them every frame. Instead you can make a few primitive colliders for the general shapes you need and have them follow a few bones.
the problem is that my animated mesh makes large moves, so it make things really wierd when my character collides with ‘nothing’ instead of the real mesh…
I dont know very much about the use of bones in Unity…Globally, how can I make some colliders follow the bones ?
Otherwise, is the ‘trigger’ solution available ? In fact, there’s something I didn’t understand : when I import the FBX, in the settings, I can specify ‘Meshes have colliders’, but it don’t understand what it means, as I always manually added MeshColliders on my objects. What does this option stands for, please ?
This answers a problem i also had, with an animated door.
I tried adding all types of collision, but when the door opened, the player still couldnt go through the door, then i realised the collision wasnt moving with it.
Am i right in saying that what i need to do is add a collision mesh that animates with the door, then use that as the collision mesh? Surely thats just the same principle of adding a box collider, except the box collider wont animate
Well, a door would be very easily served by a box collider. Generally you don’t want to use mesh colliders for anything that moves, if you can get away with it (or any objects at all, actually, if they can be approximated with primitive colliders). As discussed above, mesh colliders don’t animate. Personally I make doors with code rather than using animations (much more flexibility that way), but if you did animate a door, then attach a box collider to the bone for the door and make the collider have the appropriate dimensions so it matches up.
I have uploaded the door object if you could be so kind as to check it out. You will also see that my door animation doesnt finish to its last keyframe, and doesnt close as it should(i imentioned this in another thread)
I tried it and it doesnt work, as the main door is named as the tag, and the bone is part of its mesh, unity is not seeing the bone as having the animation but obviously the main door item, therefore when the player aproaches the door, the collision works, but now the door doesnt open.
I raelly didnt know it was this hard for animated collision objects.
I’m not sure what you mean…the bone that’s animated is called “Bone”, and is below U3DRoot and above Bone1. It works fine, although the door file could be simplified a lot–the animated bone is buried under a number of transforms which don’t need to be there.
Is there any way to do this kind of parenting to bones in Blender instead of in Unity? I’m creating all of my colliders in Blender, as meshes, and having them automatically converted to colliders. Blender doesn’t seem to allow me to parent to bones, only to the whole Armature.