Problem with a sword

Hi,
i have a ghost mesh, a ghost armature, a ghost sword and a dynamic box.
The armature controls the mesh, the sword is parented to the armature, the armature to the box.
Now i want to create a sensor that make something when the sword collide with something else. But the sword is a ghost, and then collision doesn’t work. And if i uncheck the ghost property, my mesh run away because the sword interacts with the box…
So how can i make this sensor?

Ghost objects still register collisions. Use parent-to-bone instead of parenting the sword to the whole armature. You should be able to do this by selecting the sword and the armature, putting the armature in pose mode, selecting the bone you want the sword parented to and pressing Ctrl+P.

Edit: The reason you need to do this is that collision meshes do not update with mesh deformations caused by armatures. Parent to bone works around this problem by moving the actual object, not just deforming it.

Well, the thing is a bit more complicated.
The sword is parented to an empty that is parented to a mesh that is parented to a bone of an armature.
I’ve done this because i change the parent of the sword inside the game, and if i parent it to another object that isn’t the empty the sword would change dimension.
Btw, if i do so there aren’t problems with deformation, right?

I’ve made a test, and the sensor seams not to work…
Moreover ghost description says “Object does not restitute collisions, like a ghost”. I don’t know…
Maybe can you upload me a blend?:slight_smile:

(another little problem: when my dynamic box touch an object with a sensor collision, the sensor is activated 2 times… Once when the object touch the other one, and the second time when it go away form it. Why?)

PS. thanks for the huge help!!:yes:

use an empty parented sword for collision. empty type should be “sensor”.

in empty logic window, use collision sensor. when collision to enemy, send message to main_character such as “garchhhhh” :smiley:

i think it works in this way. I tried like this.

i tried, but it seams not to work… Maybe a bug in the 2.53 build? (i use lastest fro graphicall)

First off, make sure the empty is parented to the bone, not the mesh as you said it was.

Secondly, try making the sword a sensor, rather than a ghost (in the pulldown where you would set it to dynamic or static, instead choose sensor)

I tried… But it doesn’t work…
I upload the blend.
Please correct my error!! :slight_smile:

http://www.pasteall.org/blend/3333

(blender 2.53 from graphicall)