Page 1 of 1

Connect Entities

Posted: Wed Nov 06, 2013 4:51 pm
by templar_vii
Hi BEPU-Friends

Im new on BEPU.

I'd like to connect two entities.
I need a parent-entity and some connected child entities.
When I rotate the parent-entity all child's should also be rotated.
When I rotate a child-entity, the parent should stay at his place.

I don't need any physical behavior between the entities, so I think a Joint would not be the correct way.

For sure I could just transform all child's with the same transform-matrix as I do on the parent.
But I wondered if there's a construct to connect entities directly by the framework.

Thanks a lot!

Re: Connect Entities

Posted: Wed Nov 06, 2013 8:03 pm
by Norbo
If you wanted a completely rigid relationship between the connected objects and proper collision response, creating a CompoundShape would make sense here. The downside is that CompoundShapes are designed to be immutable. To change the transforms of individual children relative to the whole, the collidable itself would have to be recreated.

It would also be up to you to manage the child transforms as desired during modification. An entity using a compound shape will use a physical center of mass; to make it behave like the parent is the center of mass, the entity.CollisionInformation.LocalPosition would need to be set.

If this is for some purpose where proper collision response during modification is irrelevant, like an offline object editor, then I would recommend just handling the transforms manually without introducing compounds.

Re: Connect Entities

Posted: Sat Nov 09, 2013 6:08 am
by Duckocide
If you want angular (orientation) control of the satellite entity. You could try a couple of entities for the satellite objects. The first would be a simple entity (a sphere say) connected to the main entity via a weld joint. That would give you relative orientation etc. You'll need to make sure the weld joint is strong enough to withstand main/satellite entity forces via spring settings. Big mass will make the weld flex.

Then have another entity (shape of the satellite) connected to the welded sphere with an angular motor constraint for control. Not sure what control you want, but there are many. Revolute joints, prismatic, universal, etc. Remember to add the no broad phase collision rule to the two satellite entities - stops unwanted collision detection between the satelite entities.

I've used this approach recently for gun turrets and compound elements to large space ships (e.g hangars and lifts attached to main ship section objects). Weld joint's are becoming a favourite constraint of mine :)

https://www.youtube.com/watch?v=GvjWZJC5Ec4