StaticMesh,constraints and rotating

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Phippu
Posts: 24
Joined: Fri Jun 03, 2011 3:39 pm

StaticMesh,constraints and rotating

Post by Phippu »

Hi Norbo

I created a rope/chain that consists of boxes that are connected using the DistanceLimit. The first element of that chain should be attached to a StaticMesh (by a DistanceLimit constraint for example), but unfortunately, the DistanceLimit does support only entities, which the StaticMesh is not. So I created a very small kinematic sphere and attached the chain to that sphere. In the update call is set the WorldTransformation of that sphere to that of the StaticMesh. Is this the correct way or is there any more proper way?

The reason why I do this is because the StaticMesh rotates, this leads me to the next question: Is is proper to just set the wolrdtransformation of the StaticMesh to a custom rotation matrix? I'am asking because often the chain falls trough the static mesh, so I gues this is not the right way. Also I'am not sure if that StaticMesh is a good idea, should I rather use a InstancedMesh or a CompoundBody and use constraints to allow rotation but no translation?

By the way: I have to say once again that your engine is just awesome, thank you very much!
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: StaticMesh,constraints and rotating

Post by Norbo »

So I created a very small kinematic sphere and attached the chain to that sphere. In the update call is set the WorldTransformation of that sphere to that of the StaticMesh. Is this the correct way or is there any more proper way?
Simulating the attachment to a static mesh is the same as attaching to the static 'world' frame. Passing in null for one of the connections in the constraint will force it to attach to that special 'world' entity. Doing this does require some extra care to avoid misconfiguring the constraint, but it can work.

However...
The reason why I do this is because the StaticMesh rotates, this leads me to the next question: Is is proper to just set the wolrdtransformation of the StaticMesh to a custom rotation matrix? I'am asking because often the chain falls trough the static mesh, so I gues this is not the right way. Also I'am not sure if that StaticMesh is a good idea, should I rather use a InstancedMesh or a CompoundBody and use constraints to allow rotation but no translation?
If you need a mesh that moves, then the MobileMesh entity would be ideal. Approximations are preferred over using a MobileMesh, but sometimes it is the best option when you truly need mesh detail. A kinematic entity would not need extra constraints to control its linear motion since no dynamic forces can cause a kinematic entity to move.
By the way: I have to say once again that your engine is just awesome, thank you very much!
Thanks :)
Phippu
Posts: 24
Joined: Fri Jun 03, 2011 3:39 pm

Re: StaticMesh,constraints and rotating

Post by Phippu »

Thank you' I totaly forgot about the MobileMesh! I'll try with that one:-) I have also some strange behaviour with the constrains (jiggle), but I first will have a closer look at the documentation bevore I start bothering you, thank you for your answers!
Post Reply