Arrows on a shield, HingeJoint?

Hi!



I would like to to know if I should use HingeJoint (or other joint) or something else like CompoundCollisionShape reusing the two objects being attached?



I had little time so I couldnt yet look too much for an example…



The joint must be static, like an arrow shot on a shield.



But, I am getting weird effects, mainly when I set one of them to static (mass=0), I have to set all to mass=0 promptly, otherwise the objects shake so much that fly away and freeze the application.



I did this (event is PhysicsCollisionEvent):

[patch]

HingeJoint hj = new HingeJoint(

this,otherPRB,

event.getLocalPointA(),event.getLocalPointB(),

Vector3f.UNIT_Y,Vector3f.UNIT_Y);

//hj.setAngularOnly(true);

hj.setCollisionBetweenLinkedBodys(false);

hj.setLimit(0,0);

getPhysicsSpace().add(hj);

[/patch]



thx!

Interesting problem:)

I think I would:

-Add the arrow geometry to a shield node (containg the shield geometry) upon arrow impact

-Remove the arrow from physicsspace

-Recreate the rigidbody for the shield node

This would in affect create a CompoundCollisionShape combining the shield and arrow afaik.



A possibility is that the arrows don´t need to collide with things. In that case, I would skip the recreate the rigidbody for the shield node part and modify the mass of the shield if that is of importance.

Your shaking is probably because the mass difference betweena rrow and shild is very high. Try to use unrealistic masses that are far more similar that should help. (like a 20kg arrow)



But i suggest to just attach it to the shild if no collision is needed.