path: root/legacy/ephysics/src/lib/ephysics_world.cpp
diff options
authorLeandro Dorileo <>2012-11-29 18:51:51 +0000
committerLeandro Dorileo <>2012-11-29 18:51:51 +0000
commit0b558bc80ce7c6ed4bae0c64fd0c37cd0c8a1fab (patch)
tree21bb2b60852cde6eb5d6e9fa2af43b3023380f2e /legacy/ephysics/src/lib/ephysics_world.cpp
parent603239627c12d8f855bc3da610cf6cae1c48749d (diff)
EPhysics: generic constraint
This patch changes how constraints are created and configured, now we use a bullet generic implementation which let us operate on the 6 degrees of freedom(linear and angular ones). We have used 6dof for slider constraint but now we assume 2 types of constraints, single body - simply ephysics_constraint_add(body) - and a linked one - ephysics_constraint_linked_add(body1, body2) used to constrain 2 bodies linked together. Having said that we introduce the following changes: + migrate p2p constraint to 6Dof We want to have a constraint api generic enouth to allow many different constraint behaviour, 6Dof was picked to do that, so p2p needs a migration. + move ephysics_constraint_slider_* functions Since the whole constraint infra-sctructure is being migrated to 6Dof the linear and angular limit functions - previously used only by slider constraint - now looks more generic enough to be used by constraint in general. + add constraint anchor API Instead of telling the anchoring positioning in the constraint creating we have set it's default value to the the middle os the body and if the user wants to change it call ephysics_constraint_anchor_set and reset it. The ephysics_constraint_anchor_set() considers the canvas coordinate instead of using the body orientation. So now one can tell a constraints anchor is set to 100, 10, 0 in the canvas coordinate system and not (body_center.x - 20, body_center.y - 5, body_center.z - 1). + constraint migrate the bt_constraint Since we're working only with 6Dof constraints it is reasonable to change the constraints bt_constraint field to btGeneric6DofConstraint. + add 3 axes to constraints Now constraints API knows about x, y and z axes - linear and angular limiting, anchor setting and the constraint creation functions are fully supported. + constraint calls are renamed The constraint calls were renamed so ephysics_constraint_p2p_add() now is known as ephysics_constraint_linked_add() and ephysics_constraint_slider_add() became ephysics_constraint_add() where the first one is meant for constrain 2 bodies and the second one for single body constraints. --This line, and those below, will be ignored-- SVN revision: 79848
Diffstat (limited to '')
1 files changed, 3 insertions, 3 deletions
diff --git a/legacy/ephysics/src/lib/ephysics_world.cpp b/legacy/ephysics/src/lib/ephysics_world.cpp
index 8ee9481d5a..f1004bb3c8 100644
--- a/legacy/ephysics/src/lib/ephysics_world.cpp
+++ b/legacy/ephysics/src/lib/ephysics_world.cpp
@@ -500,14 +500,14 @@ ephysics_world_soft_body_add(EPhysics_World *world, EPhysics_Body *body)
500} 500}
501 501
502void 502void
503ephysics_world_constraint_add(EPhysics_World *world, EPhysics_Constraint *constraint, btTypedConstraint *bt_constraint) 503ephysics_world_constraint_add(EPhysics_World *world, EPhysics_Constraint *constraint, btGeneric6DofConstraint *bt_constraint)
504{ 504{
505 world->dynamics_world->addConstraint(bt_constraint); 505 world->dynamics_world->addConstraint(bt_constraint, true);
506 world->constraints = eina_list_append(world->constraints, constraint); 506 world->constraints = eina_list_append(world->constraints, constraint);
507} 507}
508 508
509void 509void
510ephysics_world_constraint_del(EPhysics_World *world, EPhysics_Constraint *constraint, btTypedConstraint *bt_constraint) 510ephysics_world_constraint_del(EPhysics_World *world, EPhysics_Constraint *constraint, btGeneric6DofConstraint *bt_constraint)
511{ 511{
512 world->dynamics_world->removeConstraint(bt_constraint); 512 world->dynamics_world->removeConstraint(bt_constraint);
513 world->constraints = eina_list_remove(world->constraints, constraint); 513 world->constraints = eina_list_remove(world->constraints, constraint);