109 MMechostr(MSKDEBUG,
"getMaterialContactCallback\n");
114 MCOLL* result = (MCOLL*)
param;
116 SNode* node1 = result->curScene->GetNode(result->node1);
118 if ((node0 == 0) || (node1 == 0))
121 if (node0->GetSceneNodeBody() == NULL || node1->GetSceneNodeBody() == NULL)
130 if (MMfetch(m, obj, OFFOBJREF0 + SO3_MATERIALPAIR_COLLISION * 2) == NIL)
134 int s = MMfetch(m, OBJfindTH(m,
SO3SCENETYPE, SCOL_PTR(result->curScene)), OFFOBJMAG);
136 int pos = MMmalloc(m, 3, TYPETAB);
140 int norm = MMmalloc(m, 3, TYPETAB);
144 int force = MMmalloc(m, 3, TYPETAB);
149 MMsetglobal(m, OFFSCCUR, MMfetch(m, obj, OFFOBJCHN));
150 if (MMpush(m, MMgetglobal(m, OFFSCCUR)))
return MERRMEM;
151 if (MMpush(m, MMfetch(m, obj, OFFOBJREF0 + SO3_MATERIALPAIR_COLLISION * 2)))
return MERRMEM;
152 if (MMpush(m, s))
return MERRMEM;
153 if (MMpush(m, MMfetch(m, obj, OFFOBJREF0 + SO3_MATERIALPAIR_COLLISION * 2 + 1)))
return MERRMEM;
155 int b0 = MMfetch(m, OBJfindTH(m,
SO3PHYSICBODY, SCOL_PTR(node0->GetSceneNodeBody())), OFFOBJMAG);
156 int b1 = MMfetch(m, OBJfindTH(m,
SO3PHYSICBODY, SCOL_PTR(node1->GetSceneNodeBody())), OFFOBJMAG);
161 MMstore(m, pos, 0, FTOM(result->position.x));
162 MMstore(m, pos, 1, FTOM(result->position.y));
163 MMstore(m, pos, 2, FTOM(result->position.z));
165 MMpush(m, PTOM(pos));
167 MMstore(m, norm, 0, FTOM(result->normal.x));
168 MMstore(m, norm, 1, FTOM(result->normal.y));
169 MMstore(m, norm, 2, FTOM(result->normal.z));
170 MMpush(m, PTOM(norm));
172 MMstore(m, force, 0, FTOM(result->force.x));
173 MMstore(m, force, 1, FTOM(result->force.y));
174 MMstore(m, force, 2, FTOM(result->force.z));
175 MMpush(m, PTOM(force));
176 MMpush(m, FTOM(result->normalspeed));
178 res = OBJcallreflex(m, 6);
197 MMechostr(MSKDEBUG,
"getMaterialOverlapStartedCallback\n");
201 MCOLL* result = (MCOLL*)
param;
203 SNode* node1 = result->curScene->GetNode(result->node1);
205 if ((node0 == 0) || (node1 == 0))
214 if (MMfetch(m, obj, OFFOBJREF0 + SO3_MATERIALPAIR_OVERLAP_STARTED * 2) == NIL)
218 int s = MMfetch(m, OBJfindTH(m,
SO3SCENETYPE, SCOL_PTR(result->curScene)), OFFOBJMAG);
221 MMsetglobal(m, OFFSCCUR, MMfetch(m, obj, OFFOBJCHN));
222 if (MMpush(m, MMgetglobal(m, OFFSCCUR)))
return MERRMEM;
223 if (MMpush(m, MMfetch(m, obj, OFFOBJREF0 + SO3_MATERIALPAIR_OVERLAP_STARTED * 2)))
return MERRMEM;
224 if (MMpush(m, s))
return MERRMEM;
225 if (MMpush(m, MMfetch(m, obj, OFFOBJREF0 + SO3_MATERIALPAIR_OVERLAP_STARTED * 2 + 1)))
return MERRMEM;
227 if (node0->GetSceneNodeBody() == NULL)
234 if (node1->GetSceneNodeBody() == NULL)
244 b0 = MMfetch(m, OBJfindTH(m,
SO3PHYSICBODY, SCOL_PTR(node0->GetSceneNodeBody())), OFFOBJMAG);
245 b1 = MMfetch(m, OBJfindTH(m,
SO3PHYSICBODY, SCOL_PTR(node1->GetSceneNodeBody())), OFFOBJMAG);
250 res = OBJcallreflex(m, 2);
269 MMechostr(MSKDEBUG,
"getMaterialOverlapEndedCallback\n");
273 MCOLL* result = (MCOLL*)
param;
275 SNode* node1 = result->curScene->GetNode(result->node1);
277 if ((node0 == 0) || (node1 == 0))
286 if (MMfetch(m, obj, OFFOBJREF0 + SO3_MATERIALPAIR_OVERLAP_ENDED * 2) == NIL)
290 int s = MMfetch(m, OBJfindTH(m,
SO3SCENETYPE, SCOL_PTR(result->curScene)), OFFOBJMAG);
293 MMsetglobal(m, OFFSCCUR, MMfetch(m, obj, OFFOBJCHN));
294 if (MMpush(m, MMgetglobal(m, OFFSCCUR)))
return MERRMEM;
295 if (MMpush(m, MMfetch(m, obj, OFFOBJREF0 + SO3_MATERIALPAIR_OVERLAP_ENDED * 2)))
return MERRMEM;
296 if (MMpush(m, s))
return MERRMEM;
297 if (MMpush(m, MMfetch(m, obj, OFFOBJREF0 + SO3_MATERIALPAIR_OVERLAP_ENDED * 2 + 1)))
return MERRMEM;
299 if (node0->GetSceneNodeBody() == NULL)
306 if (node1->GetSceneNodeBody() == NULL)
316 b0 = MMfetch(m, OBJfindTH(m,
SO3PHYSICBODY, SCOL_PTR(node0->GetSceneNodeBody())), OFFOBJMAG);
317 b1 = MMfetch(m, OBJfindTH(m,
SO3PHYSICBODY, SCOL_PTR(node1->GetSceneNodeBody())), OFFOBJMAG);
322 res = OBJcallreflex(m, 2);
343 int fps = MTOI(MMpull(m));
351 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
358 if (!scene->GetPhysicsWorld())
367 scene->GetPhysicsWorld()->SetPhysicFPS(fps);
369 MMset(m, 0, ITOM(1));
372 catch (Ogre::Exception &e)
374 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
402 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
409 if (!scene->GetPhysicsWorld())
415 MMset(m, 0, ITOM(scene->GetPhysicsWorld()->GetPhysicFPS()));
431 MMechostr(MSKDEBUG,
"SO3WorldSetSize\n");
434 int sizeMax = MTOP(MMpull(m));
435 int sizeMin = MTOP(MMpull(m));
443 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
450 if (!scene->GetPhysicsWorld())
458 Ogre::Vector3 vectorMin;
459 vectorMin.x = MTOF(MMfetch(m, sizeMin, 0));
460 vectorMin.y = MTOF(MMfetch(m, sizeMin, 1));
461 vectorMin.z = MTOF(MMfetch(m, sizeMin, 2));
463 Ogre::Vector3 vectorMax;
464 vectorMax.x = MTOF(MMfetch(m, sizeMax, 0));
465 vectorMax.y = MTOF(MMfetch(m, sizeMax, 1));
466 vectorMax.z = MTOF(MMfetch(m, sizeMax, 2));
467 scene->GetPhysicsWorld()->SetPhysicWorldSize(vectorMin, vectorMax);
471 catch (Ogre::Exception &e)
473 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
497 MMechostr(MSKDEBUG,
"SO3WorldSetFrictionModel\n");
522 MMechostr(MSKDEBUG,
"SO3WorldGetFrictionModel\n");
548 MMechostr(MSKDEBUG,
"SO3WorldSetPlateformArchitecture\n");
559 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
570 mod = SO3_PA_DEFAULT;
571 else if (
mod > SO3_PA_BEST)
574 if (!scene->GetPhysicsWorld())
582 scene->GetPhysicsWorld()->SetPhysicPlatformArchitecture(
mod);
583 MMset(m, 0, ITOM(1));
586 catch (Ogre::Exception& e)
588 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
612 MMechostr(MSKDEBUG,
"SO3WorldGetPlateformArchitecture\n");
622 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
629 if (!scene->GetPhysicsWorld())
637 MMset(m, 0, ITOM(scene->GetPhysicsWorld()->GetPhysicPlatformArchitecture()));
640 catch (Ogre::Exception& e)
642 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
665 MMechostr(MSKDEBUG,
"SO3WorldSetSolverModel\n");
676 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
687 mod = SO3_SM_ADAPTATIVE;
689 if (!scene->GetPhysicsWorld())
697 scene->GetPhysicsWorld()->SetPhysicSolverModel(
mod);
698 MMset(m, 0, ITOM(1));
701 catch (Ogre::Exception& e)
703 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
725 MMechostr(MSKDEBUG,
"SO3WorldGetSolverModel\n");
734 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
741 if (!scene->GetPhysicsWorld())
747 MMset(m, 0, ITOM(scene->GetPhysicsWorld()->GetPhysicSolverModel()));
764 MMechostr(MSKDEBUG,
"SO3WorldSetEnabled\n");
767 int booleen = MTOI(MMpull(m));
776 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
783 if (!scene->GetPhysicsWorld())
791 scene->GetPhysicsWorld()->SetPhysicWorldEnable(
false);
796 MMechostr(MSKDEBUG,
" > World is Set To Enable\n");
799 scene->GetPhysicsWorld()->SetPhysicWorldEnable(
true);
802 MMset(m, 0, ITOM(1));
818 MMechostr(MSKDEBUG,
"SO3WorldGetEnabled\n");
828 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
835 if (!scene->GetPhysicsWorld())
842 if (scene->GetPhysicsWorld()->GetPhysicWorldEnable())
845 MMset(m, 0, ITOM(val));
870 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
877 if (!scene->GetPhysicsWorld())
883 scene->GetPhysicsWorld()->ResetPhysicWorld();
885 MMset(m, 0, ITOM(1));
900 MMechostr(MSKDEBUG,
"SO3WorldSetBodiesInitialState\n");
910 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
917 if (!scene->GetPhysicsWorld())
923 scene->GetPhysicsWorld()->SetPhysicBodiesInitialState();
925 MMset(m, 0, ITOM(1));
940 MMechostr(MSKDEBUG,
"SO3BodySetInitialState\n");
943 int bod = MMget(m, 0);
950 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
957 body->GetParentNode()->StoreInitialPRS();
959 MMset(m, 0, ITOM(1));
975 MMechostr(MSKDEBUG,
"SO3WorldShowLines\n");
978 int booleen = MTOI(MMpull(m));
986 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
993 if (!scene->GetPhysicsWorld())
1000 scene->GetPhysicsWorld()->SetPhysicDebugEnable(
true);
1002 scene->GetPhysicsWorld()->SetPhysicDebugEnable(
false);
1004 MMset(m, 0, ITOM(1));
1021 MMechostr(MSKDEBUG,
"SO3WorldSetGravity\n");
1024 int vec = MTOP(MMpull(m));
1025 int s = MMget(m, 0);
1026 if ((s == NIL) || (vec == NIL))
1032 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
1039 int x = MMfetch(m, vec, 0);
1040 int y = MMfetch(m, vec, 1);
1041 int z = MMfetch(m, vec, 2);
1043 if ((x == NIL) || (y == NIL) || (z == NIL))
1049 Ogre::Vector3 vgravity = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
1051 if (!scene->GetPhysicsWorld())
1057 scene->GetPhysicsWorld()->SetPhysicGravity(vgravity);
1058 MMset(m, 0, ITOM(1));
1073 MMechostr(MSKDEBUG,
"SO3WorldGetGravity\n");
1076 int s = MMget(m, 0);
1083 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
1090 if (!scene->GetPhysicsWorld())
1096 Ogre::Vector3 vec = scene->GetPhysicsWorld()->GetPhysicGravity();
1098 int tuple = MMmalloc(m, 3, TYPETAB);
1105 MMstore(m, tuple, 0, FTOM((vec.x)));
1106 MMstore(m, tuple, 1, FTOM((vec.y)));
1107 MMstore(m, tuple, 2, FTOM((vec.z)));
1108 MMset(m, 0, PTOM(tuple));
1126 MMechostr(MSKDEBUG,
"SO3BodyCreateBox\n");
1129 int vec = MTOP(MMpull(m));
1130 int n = MMget(m, 0);
1131 if ((n == NIL) || (vec == NIL))
1137 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1144 if (!node->GetParentScene()->GetPhysicsWorld())
1151 if (node->GetSceneNodeBody() != NULL)
1153 OBJdelTH(m,
SO3PHYSICBODY, SCOL_PTR(node->GetSceneNodeBody()));
1156 int x = MMfetch(m, vec, 0);
1157 int y = MMfetch(m, vec, 1);
1158 int z = MMfetch(m, vec, 2);
1160 if ((x == NIL) || (y == NIL) || (z == NIL))
1166 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
1171 body = node->CreateBoxBody(vector);
1173 catch (Ogre::Exception& e)
1175 MMechostr(MSKRUNTIME,
"Cannot create body: %s\n", e.what());
1202 MMechostr(MSKDEBUG,
"SO3BodyCreateEllipsoid\n");
1205 int vec = MTOP(MMpull(m));
1206 int n = MMget(m, 0);
1207 if ((n == NIL) || (vec == NIL))
1213 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1220 if (!node->GetParentScene()->GetPhysicsWorld())
1227 if (node->GetSceneNodeBody() != NULL)
1229 OBJdelTH(m,
SO3PHYSICBODY, SCOL_PTR(node->GetSceneNodeBody()));
1232 int x = MMfetch(m, vec, 0);
1233 int y = MMfetch(m, vec, 1);
1234 int z = MMfetch(m, vec, 2);
1236 if ((x == NIL) || (y == NIL) || (z == NIL))
1242 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
1247 body = node->CreateEllipsoidBody(vector);
1249 catch (Ogre::Exception& e)
1251 MMechostr(MSKRUNTIME,
"Cannot create body: %s\n", e.what());
1279 MMechostr(MSKDEBUG,
"SO3BodyCreateCapsule\n");
1283 int rad = MMpull(m);
1284 int n = MMget(m, 0);
1285 if ((n == NIL) || (h == NIL) || (rad == NIL))
1291 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1298 if (!node->GetParentScene()->GetPhysicsWorld())
1305 if (node->GetSceneNodeBody() != NULL)
1307 OBJdelTH(m,
SO3PHYSICBODY, SCOL_PTR(node->GetSceneNodeBody()));
1310 float height = MTOF(h);
1314 float radius = MTOF(rad);
1322 body = node->CreateCapsuleBody(radius, height);
1324 catch (Ogre::Exception& e)
1326 MMechostr(MSKRUNTIME,
"Cannot create body: %s\n", e.what());
1354 MMechostr(MSKDEBUG,
"SO3BodyCreateChamferCylinder\n");
1358 int rad = MMpull(m);
1359 int n = MMget(m, 0);
1360 if ((n == NIL) || (h == NIL) || (rad == NIL))
1366 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1373 if (!node->GetParentScene()->GetPhysicsWorld())
1380 if (node->GetSceneNodeBody() != NULL)
1382 OBJdelTH(m,
SO3PHYSICBODY, SCOL_PTR(node->GetSceneNodeBody()));
1390 body = node->CreateChamferCylinderBody(MTOF(rad), MTOF(h));
1392 catch (Ogre::Exception& e)
1394 MMechostr(MSKRUNTIME,
"Cannot create body: %s\n", e.what());
1422 MMechostr(MSKDEBUG,
"SO3BodyCreateCone\n");
1426 int rad = MMpull(m);
1427 int n = MMget(m, 0);
1429 if ((n == NIL) || (h == NIL) || (rad == NIL))
1435 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1442 if (!node->GetParentScene()->GetPhysicsWorld())
1449 if (node->GetSceneNodeBody() != NULL)
1451 OBJdelTH(m,
SO3PHYSICBODY, SCOL_PTR(node->GetSceneNodeBody()));
1458 body = node->CreateConeBody(MTOF(rad), MTOF(h));
1460 catch (Ogre::Exception& e)
1462 MMechostr(MSKRUNTIME,
"Cannot create body: %s\n", e.what());
1490 MMechostr(MSKDEBUG,
"SO3BodyCreateCylinder\n");
1494 int rad = MMpull(m);
1495 int n = MMget(m, 0);
1496 if ((n == NIL) || (h == NIL) || (rad == NIL))
1502 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1509 if (!node->GetParentScene()->GetPhysicsWorld())
1516 if (node->GetSceneNodeBody() != NULL)
1518 OBJdelTH(m,
SO3PHYSICBODY, SCOL_PTR(node->GetSceneNodeBody()));
1525 body = node->CreateCylinderBody(MTOF(rad), MTOF(h));
1527 catch (Ogre::Exception& e)
1529 MMechostr(MSKRUNTIME,
"Cannot create body: %s\n", e.what());
1556 MMechostr(MSKDEBUG,
"SO3BodyCreatePyramid\n");
1559 int vec = MTOP(MMpull(m));
1560 int n = MMget(m, 0);
1561 if ((n == NIL) || (vec == NIL))
1567 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1574 if (!node->GetParentScene()->GetPhysicsWorld())
1581 if (node->GetSceneNodeBody() != NULL)
1583 OBJdelTH(m,
SO3PHYSICBODY, SCOL_PTR(node->GetSceneNodeBody()));
1586 int x = MMfetch(m, vec, 0);
1587 int y = MMfetch(m, vec, 1);
1588 int z = MMfetch(m, vec, 2);
1590 if ((x == NIL) || (y == NIL) || (z == NIL))
1596 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
1601 body = node->CreatePyramidBody(vector);
1603 catch (Ogre::Exception& e)
1605 MMechostr(MSKRUNTIME,
"Cannot create body: %s\n", e.what());
1634 MMechostr(MSKDEBUG,
"SO3BodyCreateBox\n");
1638 int pos = MMpull(m);
1639 int vec = MTOP(MMpull(m));
1640 int n = MMget(m, 0);
1641 if ((n == NIL) || (vec == NIL))
1647 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1654 if (!node->GetParentScene()->GetPhysicsWorld())
1661 if (node->GetSceneNodeBody() != NULL)
1663 OBJdelTH(m,
SO3PHYSICBODY, SCOL_PTR(node->GetSceneNodeBody()));
1666 int x = MMfetch(m, vec, 0);
1667 int y = MMfetch(m, vec, 1);
1668 int z = MMfetch(m, vec, 2);
1671 if ((x == NIL) || (y == NIL) || (z == NIL))
1677 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
1679 if (vector.x == 0.0f)
1682 if (vector.y == 0.0f)
1685 if (vector.z == 0.0f)
1688 Ogre::Vector3 offset(Ogre::Vector3::ZERO);
1692 x = MMfetch(m, pos, 0);
1693 y = MMfetch(m, pos, 1);
1694 z = MMfetch(m, pos, 2);
1695 offset = Ogre::Vector3((x == NIL) ? 0.0f : MTOF(x), (y == NIL) ? 0.0f : MTOF(y), (z == NIL) ? 0.0f : MTOF(z));
1698 Ogre::Quaternion quat(Ogre::Quaternion::IDENTITY);
1702 x = MMfetch(m, q, 0);
1703 y = MMfetch(m, q, 1);
1704 z = MMfetch(m, q, 2);
1705 w = MMfetch(m, q, 3);
1706 quat = Ogre::Quaternion((
w == NIL) ? 0.0f : MTOF(
w), (x == NIL) ? 0.0f : MTOF(x), (y == NIL) ? 0.0f : MTOF(y), (z == NIL) ? 0.0f : MTOF(z));
1712 body = node->CreateBoxBody(vector, offset, quat);
1714 catch (Ogre::Exception& e)
1716 MMechostr(MSKRUNTIME,
"Cannot create body: %s\n", e.what());
1745 MMechostr(MSKDEBUG,
"SO3BodyCreateEllipsoid\n");
1749 int pos = MMpull(m);
1750 int vec = MTOP(MMpull(m));
1751 int n = MMget(m, 0);
1752 if ((n == NIL) || (vec == NIL))
1758 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1765 if (!node->GetParentScene()->GetPhysicsWorld())
1772 if (node->GetSceneNodeBody() != NULL)
1774 OBJdelTH(m,
SO3PHYSICBODY, SCOL_PTR(node->GetSceneNodeBody()));
1777 int x = MMfetch(m, vec, 0);
1778 int y = MMfetch(m, vec, 1);
1779 int z = MMfetch(m, vec, 2);
1782 if ((x == NIL) || (y == NIL) || (z == NIL))
1788 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
1790 if (vector.x == 0.0f)
1793 if (vector.y == 0.0f)
1796 if (vector.z == 0.0f)
1799 Ogre::Vector3 offset(Ogre::Vector3::ZERO);
1803 x = MMfetch(m, pos, 0);
1804 y = MMfetch(m, pos, 1);
1805 z = MMfetch(m, pos, 2);
1806 offset = Ogre::Vector3((x == NIL) ? 0.0f : MTOF(x), (y == NIL) ? 0.0f : MTOF(y), (z == NIL) ? 0.0f : MTOF(z));
1809 Ogre::Quaternion quat(Ogre::Quaternion::IDENTITY);
1813 x = MMfetch(m, q, 0);
1814 y = MMfetch(m, q, 1);
1815 z = MMfetch(m, q, 2);
1816 w = MMfetch(m, q, 3);
1817 quat = Ogre::Quaternion((
w == NIL) ? 0.0f : MTOF(
w), (x == NIL) ? 0.0f : MTOF(x), (y == NIL) ? 0.0f : MTOF(y), (z == NIL) ? 0.0f : MTOF(z));
1823 body = node->CreateEllipsoidBody(vector, offset, quat);
1825 catch (Ogre::Exception& e)
1827 MMechostr(MSKRUNTIME,
"Cannot create body: %s\n", e.what());
1857 MMechostr(MSKDEBUG,
"SO3BodyCreateCapsule\n");
1861 int pos = MMpull(m);
1863 int rad = MMpull(m);
1864 int n = MMget(m, 0);
1865 if ((n == NIL) || (h == NIL) || (rad == NIL))
1871 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1878 if (!node->GetParentScene()->GetPhysicsWorld())
1885 if (node->GetSceneNodeBody() != NULL)
1887 OBJdelTH(m,
SO3PHYSICBODY, SCOL_PTR(node->GetSceneNodeBody()));
1895 Ogre::Vector3 offset(Ogre::Vector3::ZERO);
1899 x = MMfetch(m, pos, 0);
1900 y = MMfetch(m, pos, 1);
1901 z = MMfetch(m, pos, 2);
1902 offset = Ogre::Vector3((x == NIL) ? 0.0f : MTOF(x), (y == NIL) ? 0.0f : MTOF(y), (z == NIL) ? 0.0f : MTOF(z));
1905 Ogre::Quaternion quat(Ogre::Quaternion::IDENTITY);
1909 x = MMfetch(m, q, 0);
1910 y = MMfetch(m, q, 1);
1911 z = MMfetch(m, q, 2);
1912 w = MMfetch(m, q, 3);
1913 quat = Ogre::Quaternion((
w == NIL) ? 0.0f : MTOF(
w), (x == NIL) ? 0.0f : MTOF(x), (y == NIL) ? 0.0f : MTOF(y), (z == NIL) ? 0.0f : MTOF(z));
1916 float height = MTOF(h);
1920 float radius = MTOF(rad);
1928 body = node->CreateCapsuleBody(radius, height, offset, quat);
1930 catch (Ogre::Exception& e)
1932 MMechostr(MSKRUNTIME,
"Cannot create body: %s\n", e.what());
1962 MMechostr(MSKDEBUG,
"SO3BodyCreateChamferCylinder\n");
1966 int pos = MMpull(m);
1968 int rad = MMpull(m);
1969 int n = MMget(m, 0);
1970 if ((n == NIL) || (h == NIL) || (rad == NIL))
1976 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1983 if (!node->GetParentScene()->GetPhysicsWorld())
1990 if (node->GetSceneNodeBody() != NULL)
1992 OBJdelTH(m,
SO3PHYSICBODY, SCOL_PTR(node->GetSceneNodeBody()));
2000 Ogre::Vector3 offset(Ogre::Vector3::ZERO);
2004 x = MMfetch(m, pos, 0);
2005 y = MMfetch(m, pos, 1);
2006 z = MMfetch(m, pos, 2);
2007 offset = Ogre::Vector3((x == NIL) ? 0.0f : MTOF(x), (y == NIL) ? 0.0f : MTOF(y), (z == NIL) ? 0.0f : MTOF(z));
2010 Ogre::Quaternion quat(Ogre::Quaternion::IDENTITY);
2014 x = MMfetch(m, q, 0);
2015 y = MMfetch(m, q, 1);
2016 z = MMfetch(m, q, 2);
2017 w = MMfetch(m, q, 3);
2018 quat = Ogre::Quaternion((
w == NIL) ? 0.0f : MTOF(
w), (x == NIL) ? 0.0f : MTOF(x), (y == NIL) ? 0.0f : MTOF(y), (z == NIL) ? 0.0f : MTOF(z));
2021 float height = MTOF(h);
2025 float radius = MTOF(rad);
2033 body = node->CreateChamferCylinderBody(radius, height, offset, quat);
2035 catch (Ogre::Exception& e)
2037 MMechostr(MSKRUNTIME,
"Cannot create body: %s\n", e.what());
2067 MMechostr(MSKDEBUG,
"SO3BodyCreateCone\n");
2071 int pos = MMpull(m);
2073 int rad = MMpull(m);
2074 int n = MMget(m, 0);
2076 if ((n == NIL) || (h == NIL) || (rad == NIL))
2082 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2089 if (!node->GetParentScene()->GetPhysicsWorld())
2096 if (node->GetSceneNodeBody() != NULL)
2098 OBJdelTH(m,
SO3PHYSICBODY, SCOL_PTR(node->GetSceneNodeBody()));
2106 Ogre::Vector3 offset(Ogre::Vector3::ZERO);
2110 x = MMfetch(m, pos, 0);
2111 y = MMfetch(m, pos, 1);
2112 z = MMfetch(m, pos, 2);
2113 offset = Ogre::Vector3((x == NIL) ? 0.0f : MTOF(x), (y == NIL) ? 0.0f : MTOF(y), (z == NIL) ? 0.0f : MTOF(z));
2116 Ogre::Quaternion quat(Ogre::Quaternion::IDENTITY);
2120 x = MMfetch(m, q, 0);
2121 y = MMfetch(m, q, 1);
2122 z = MMfetch(m, q, 2);
2123 w = MMfetch(m, q, 3);
2124 quat = Ogre::Quaternion((
w == NIL) ? 0.0f : MTOF(
w), (x == NIL) ? 0.0f : MTOF(x), (y == NIL) ? 0.0f : MTOF(y), (z == NIL) ? 0.0f : MTOF(z));
2127 float height = MTOF(h);
2131 float radius = MTOF(rad);
2139 body = node->CreateConeBody(radius, height, offset, quat);
2141 catch (Ogre::Exception& e)
2143 MMechostr(MSKRUNTIME,
"Cannot create body: %s\n", e.what());
2173 MMechostr(MSKDEBUG,
"SO3BodyCreateCylinder\n");
2177 int pos = MMpull(m);
2179 int rad = MMpull(m);
2180 int n = MMget(m, 0);
2181 if ((n == NIL) || (h == NIL) || (rad == NIL))
2187 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2194 if (!node->GetParentScene()->GetPhysicsWorld())
2201 if (node->GetSceneNodeBody() != NULL)
2203 OBJdelTH(m,
SO3PHYSICBODY, SCOL_PTR(node->GetSceneNodeBody()));
2211 Ogre::Vector3 offset(Ogre::Vector3::ZERO);
2215 x = MMfetch(m, pos, 0);
2216 y = MMfetch(m, pos, 1);
2217 z = MMfetch(m, pos, 2);
2218 offset = Ogre::Vector3((x == NIL) ? 0.0f : MTOF(x), (y == NIL) ? 0.0f : MTOF(y), (z == NIL) ? 0.0f : MTOF(z));
2221 Ogre::Quaternion quat(Ogre::Quaternion::IDENTITY);
2225 x = MMfetch(m, q, 0);
2226 y = MMfetch(m, q, 1);
2227 z = MMfetch(m, q, 2);
2228 w = MMfetch(m, q, 3);
2229 quat = Ogre::Quaternion((
w == NIL) ? 0.0f : MTOF(
w), (x == NIL) ? 0.0f : MTOF(x), (y == NIL) ? 0.0f : MTOF(y), (z == NIL) ? 0.0f : MTOF(z));
2232 float height = MTOF(h);
2236 float radius = MTOF(rad);
2244 body = node->CreateCylinderBody(radius, height, offset, quat);
2246 catch (Ogre::Exception& e)
2248 MMechostr(MSKRUNTIME,
"Cannot create body: %s\n", e.what());
2277 MMechostr(MSKDEBUG,
"SO3BodyCreatePyramid\n");
2281 int pos = MMpull(m);
2282 int vec = MTOP(MMpull(m));
2283 int n = MMget(m, 0);
2284 if ((n == NIL) || (vec == NIL))
2290 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2297 if (!node->GetParentScene()->GetPhysicsWorld())
2304 if (node->GetSceneNodeBody() != NULL)
2306 OBJdelTH(m,
SO3PHYSICBODY, SCOL_PTR(node->GetSceneNodeBody()));
2309 int x = MMfetch(m, vec, 0);
2310 int y = MMfetch(m, vec, 1);
2311 int z = MMfetch(m, vec, 2);
2314 if ((x == NIL) || (y == NIL) || (z == NIL))
2320 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
2322 if (vector.x == 0.0f)
2325 if (vector.y == 0.0f)
2328 if (vector.z == 0.0f)
2331 Ogre::Vector3 offset(Ogre::Vector3::ZERO);
2335 x = MMfetch(m, pos, 0);
2336 y = MMfetch(m, pos, 1);
2337 z = MMfetch(m, pos, 2);
2338 offset = Ogre::Vector3((x == NIL) ? 0.0f : MTOF(x), (y == NIL) ? 0.0f : MTOF(y), (z == NIL) ? 0.0f : MTOF(z));
2341 Ogre::Quaternion quat(Ogre::Quaternion::IDENTITY);
2345 x = MMfetch(m, q, 0);
2346 y = MMfetch(m, q, 1);
2347 z = MMfetch(m, q, 2);
2348 w = MMfetch(m, q, 3);
2349 quat = Ogre::Quaternion((
w == NIL) ? 0.0f : MTOF(
w), (x == NIL) ? 0.0f : MTOF(x), (y == NIL) ? 0.0f : MTOF(y), (z == NIL) ? 0.0f : MTOF(z));
2355 body = node->CreatePyramidBody(vector, offset, quat);
2357 catch (Ogre::Exception& e)
2359 MMechostr(MSKRUNTIME,
"Cannot create body: %s\n", e.what());
2386 MMechostr(MSKDEBUG,
"SO3BodyCreateCollisionTree\n");
2389 int opti = MMpull(m);
2390 int n = MMget(m, 0);
2397 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2404 bool optimize =
false;
2405 if (MTOI(opti) == 1)
2406 bool optimize =
true;
2408 if ((node->GetNodeType() != SNode::ENTITY_TYPE_ID))
2414 if (!node->GetParentScene()->GetPhysicsWorld())
2421 if (node->GetSceneNodeBody() != NULL)
2423 OBJdelTH(m,
SO3PHYSICBODY, SCOL_PTR(node->GetSceneNodeBody()));
2427 SBody* body = node->CreateTreeBody(optimize);
2453 MMechostr(MSKDEBUG,
"SO3BodyCreateShape\n");
2456 int toler = MMpull(m);
2457 int n = MMget(m, 0);
2464 float tolerance = 0;
2466 tolerance = MTOF(toler);
2468 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2475 if (node->GetNodeType() != SNode::ENTITY_TYPE_ID)
2481 SEntity* entity =
static_cast<SEntity*
> (node);
2482 if (!entity || !entity->getOgreEntityPointer())
2488 if (!node->GetParentScene()->GetPhysicsWorld())
2495 if (node->GetSceneNodeBody() != NULL)
2497 OBJdelTH(m,
SO3PHYSICBODY, SCOL_PTR(node->GetSceneNodeBody()));
2505 body = node->CreateConvexHullBody(tolerance);
2507 catch (Ogre::Exception)
2537 MMechostr(MSKDEBUG,
"SO3BodyCreateConcaveShape\n");
2540 int toler = MMpull(m);
2541 int n = MMget(m, 0);
2548 float tolerance = 0;
2550 tolerance = MTOF(toler);
2552 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2559 if (node->GetNodeType() != SNode::ENTITY_TYPE_ID)
2565 SEntity* entity =
static_cast<SEntity*
> (node);
2566 if (!entity || !entity->getOgreEntityPointer())
2572 if (!node->GetParentScene()->GetPhysicsWorld())
2579 if (node->GetSceneNodeBody() != NULL)
2581 OBJdelTH(m,
SO3PHYSICBODY, SCOL_PTR(node->GetSceneNodeBody()));
2589 body = node->CreateConcaveHullBody(tolerance);
2591 catch (Ogre::Exception)
2621 MMechostr(MSKDEBUG,
"SO3BodyGetShapeDefinition\n");
2624 int bod = MMget(m, 0);
2631 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
2638 SShape* shape = body->GetShape();
2645 float tolerance = 0.0f;
2646 float radius = 0.0f;
2647 float height = 0.0f;
2650 SShape::ShapeType stype = shape->GetType();
2652 Ogre::Vector3 offsetpos = shape->GetBaseOffset();
2653 Ogre::Quaternion offsetquat = shape->GetBaseRotation();
2655 if (stype == SShape::SO3_BOX_COLLISION)
2658 size = bshape->GetSize();
2660 else if (stype == SShape::SO3_CAPSULE_COLLISION)
2663 radius = bshape->GetRadius();
2664 height = bshape->GetHeight();
2666 else if (stype == SShape::SO3_CHAMFERCYLINDRE_COLLISION)
2669 radius = bshape->GetRadius();
2670 height = bshape->GetHeight();
2672 else if (stype == SShape::SO3_CONE_COLLISION)
2675 radius = bshape->GetRadius();
2676 height = bshape->GetHeight();
2678 else if (stype == SShape::SO3_CYLINDER_COLLISION)
2681 radius = bshape->GetRadius();
2682 height = bshape->GetHeight();
2684 else if (stype == SShape::SO3_ELLIPSOID_COLLISION)
2686 SShapeEllipsoid* bshape =
static_cast<SShapeEllipsoid*
>(shape);
2687 size = bshape->GetSize();
2689 else if (stype == SShape::SO3_PYRAMID_COLLISION)
2692 size = bshape->GetSize();
2694 else if (stype == SShape::SO3_CONCAVE_COLLISION)
2697 tolerance = bshape->GetTolerance();
2699 else if (stype == SShape::SO3_SHAPE_COLLISION)
2702 tolerance = bshape->GetTolerance();
2711 MMpush(m, ITOM((
int)stype));
2712 MMpush(m, FTOM(tolerance));
2714 int trh = MMmalloc(m, 2, TYPETAB);
2721 MMstore(m, trh, 0, FTOM(radius));
2722 MMstore(m, trh, 1, FTOM(height));
2723 MMpush(m, PTOM(trh));
2725 int tsize = MMmalloc(m, 3, TYPETAB);
2731 MMstore(m, tsize, 0, FTOM(size.x));
2732 MMstore(m, tsize, 1, FTOM(size.y));
2733 MMstore(m, tsize, 2, FTOM(size.z));
2734 MMpush(m, PTOM(tsize));
2736 int toffset = MMmalloc(m, 3, TYPETAB);
2742 MMstore(m, toffset, 0, FTOM(offsetpos.x));
2743 MMstore(m, toffset, 1, FTOM(offsetpos.y));
2744 MMstore(m, toffset, 2, FTOM(offsetpos.z));
2745 MMpush(m, PTOM(toffset));
2747 int torientation = MMmalloc(m, 4, TYPETAB);
2748 if (torientation == NIL)
2753 MMstore(m, torientation, 0, FTOM(offsetquat.x));
2754 MMstore(m, torientation, 1, FTOM(offsetquat.y));
2755 MMstore(m, torientation, 2, FTOM(offsetquat.z));
2756 MMstore(m, torientation, 3, FTOM(offsetquat.w));
2757 MMpush(m, PTOM(torientation));
2760 int result = MMmalloc(m, 6, TYPETAB);
2766 MMstore(m, result, 5, MMpull(m));
2767 MMstore(m, result, 4, MMpull(m));
2768 MMstore(m, result, 3, MMpull(m));
2769 MMstore(m, result, 2, MMpull(m));
2770 MMstore(m, result, 1, MMpull(m));
2771 MMstore(m, result, 0, MMpull(m));
2772 MMset(m, 0, PTOM(result));
2788 MMechostr(MSKDEBUG,
"SO3BodySetMass\n");
2791 int mass = MMpull(m);
2792 int bod = MMget(m, 0);
2793 if ((bod == NIL) || (mass == NIL))
2799 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
2806 Ogre::Real omass = (Ogre::Real)MTOF(mass);
2807 body->SetMass(omass);
2809 MMset(m, 0, ITOM(1));
2826 MMechostr(MSKDEBUG,
"SO3BodyCreateBasicJointUpVector\n");
2829 int vel = MTOP(MMpull(m));
2830 int bod = MMget(m, 0);
2831 if ((bod == NIL) || (vel == NIL))
2837 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
2844 Ogre::Vector3 vector(MTOF(MMfetch(m, vel, 0)),
2845 MTOF(MMfetch(m, vel, 1)),
2846 MTOF(MMfetch(m, vel, 2)));
2848 body->SetUpJoint(vector);
2850 MMset(m, 0, ITOM(1));
2866 MMechostr(MSKDEBUG,
"SO3BodyDestroyBasicJointUpVector\n");
2869 int bod = MMget(m, 0);
2876 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
2883 body->RemoveUpJoint();
2902 MMechostr(MSKDEBUG,
"SO3BodySetForce\n");
2905 int vec = MMpull(m);
2906 int bod = MMget(m, 0);
2907 if ((bod == NIL) || (vec == NIL))
2913 SBody * body = MMgetPointer<SBody*>(m, MTOP(bod));
2921 int x = MMfetch(m, vec, 0);
2922 int y = MMfetch(m, vec, 1);
2923 int z = MMfetch(m, vec, 2);
2925 if ((x == NIL) || (y == NIL) || (z == NIL))
2931 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
2933 body->SetForce(vector);
2934 MMset(m, 0, ITOM(1));
2951 MMechostr(MSKDEBUG,
"SO3BodyAddForce\n");
2954 int vec = MTOP(MMpull(m));
2955 int bod = MMget(m, 0);
2956 if ((bod == NIL) || (vec == NIL))
2962 SBody * body = MMgetPointer<SBody*>(m, MTOP(bod));
2969 int x = MMfetch(m, vec, 0);
2970 int y = MMfetch(m, vec, 1);
2971 int z = MMfetch(m, vec, 2);
2973 if ((x == NIL) || (y == NIL) || (z == NIL))
2979 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
2981 body->SetForce(body->GetForce() + vector);
2982 MMset(m, 0, ITOM(1));
2998 MMechostr(MSKDEBUG,
"SO3BodyGetForce\n");
3001 int bod = MMget(m, 0);
3008 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
3015 Ogre::Vector3 vector = body->GetForce();
3016 int tuple = MMmalloc(m, 3, TYPETAB);
3023 MMstore(m, tuple, 0, FTOM((vector.x)));
3024 MMstore(m, tuple, 1, FTOM((vector.y)));
3025 MMstore(m, tuple, 2, FTOM((vector.z)));
3026 MMset(m, 0, PTOM(tuple));
3043 MMechostr(MSKDEBUG,
"SO3BodySetConstantForce\n");
3046 int vec = MTOP(MMpull(m));
3047 int bod = MMget(m, 0);
3048 if ((bod == NIL) || (vec == NIL))
3054 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
3061 int x = MMfetch(m, vec, 0);
3062 int y = MMfetch(m, vec, 1);
3063 int z = MMfetch(m, vec, 2);
3065 if ((x == NIL) || (y == NIL) || (z == NIL))
3071 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
3073 body->SetConstantForce(vector);
3074 MMset(m, 0, ITOM(1));
3091 MMechostr(MSKDEBUG,
"SO3BodyAddConstantForce\n");
3094 int vec = MTOP(MMpull(m));
3095 int bod = MMget(m, 0);
3096 if ((bod == NIL) || (vec == NIL))
3102 SBody * body = MMgetPointer<SBody*>(m, MTOP(bod));
3109 int x = MMfetch(m, vec, 0);
3110 int y = MMfetch(m, vec, 1);
3111 int z = MMfetch(m, vec, 2);
3113 if ((x == NIL) || (y == NIL) || (z == NIL))
3119 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
3121 body->AddConstantForce(vector);
3122 MMset(m, 0, ITOM(1));
3138 MMechostr(MSKDEBUG,
"SO3BodyGetConstantForce\n");
3141 int bod = MMget(m, 0);
3148 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
3155 Ogre::Vector3 vector = body->GetConstantForce();
3156 int tuple = MMmalloc(m, 3, TYPETAB);
3163 MMstore(m, tuple, 0, FTOM((vector.x)));
3164 MMstore(m, tuple, 1, FTOM((vector.y)));
3165 MMstore(m, tuple, 2, FTOM((vector.z)));
3166 MMset(m, 0, PTOM(tuple));
3182 MMechostr(MSKDEBUG,
"SO3BodySetConstantTorque\n");
3185 int vec = MTOP(MMpull(m));
3186 int bod = MMget(m, 0);
3187 if ((bod == NIL) || (vec == NIL))
3193 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
3200 int x = MMfetch(m, vec, 0);
3201 int y = MMfetch(m, vec, 1);
3202 int z = MMfetch(m, vec, 2);
3204 if ((x == NIL) || (y == NIL) || (z == NIL))
3210 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
3212 body->SetConstantTorque(vector);
3213 MMset(m, 0, ITOM(1));
3230 MMechostr(MSKDEBUG,
"SO3BodyAddConstantTorque\n");
3233 int vec = MTOP(MMpull(m));
3234 int bod = MMget(m, 0);
3235 if ((bod == NIL) || (vec == NIL))
3241 SBody * body = MMgetPointer<SBody*>(m, MTOP(bod));
3248 int x = MMfetch(m, vec, 0);
3249 int y = MMfetch(m, vec, 1);
3250 int z = MMfetch(m, vec, 2);
3252 if ((x == NIL) || (y == NIL) || (z == NIL))
3258 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
3260 body->AddConstantTorque(vector);
3261 MMset(m, 0, ITOM(1));
3277 MMechostr(MSKDEBUG,
"SO3BodyGetConstantTorque\n");
3280 int bod = MMget(m, 0);
3287 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
3294 Ogre::Vector3 vector = body->GetConstantTorque();
3295 int tuple = MMmalloc(m, 3, TYPETAB);
3302 MMstore(m, tuple, 0, FTOM((vector.x)));
3303 MMstore(m, tuple, 1, FTOM((vector.y)));
3304 MMstore(m, tuple, 2, FTOM((vector.z)));
3305 MMset(m, 0, PTOM(tuple));
3322 MMechostr(MSKDEBUG,
"SO3BodyAddGlobalForce\n");
3325 int vec = MTOP(MMpull(m));
3326 int bod = MMget(m, 0);
3327 if ((bod == NIL) || (vec == NIL))
3333 SBody * body = MMgetPointer<SBody*>(m, MTOP(bod));
3340 int x = MMfetch(m, vec, 0);
3341 int y = MMfetch(m, vec, 1);
3342 int z = MMfetch(m, vec, 2);
3344 if ((x == NIL) || (y == NIL) || (z == NIL))
3350 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
3352 body->SetGlobalForce(body->GetGlobalForce() + vector);
3353 MMset(m, 0, ITOM(1));
3370 MMechostr(MSKDEBUG,
"SO3BodyAddLocalForce\n");
3373 int vec = MTOP(MMpull(m));
3374 int bod = MMget(m, 0);
3375 if ((bod == NIL) || (vec == NIL))
3381 SBody * body = MMgetPointer<SBody*>(m, MTOP(bod));
3388 int x = MMfetch(m, vec, 0);
3389 int y = MMfetch(m, vec, 1);
3390 int z = MMfetch(m, vec, 2);
3392 if ((x == NIL) || (y == NIL) || (z == NIL))
3398 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
3400 body->SetLocalForce(body->GetLocalForce() + vector);
3401 MMset(m, 0, ITOM(1));
3418 MMechostr(MSKDEBUG,
"SO3BodyAddTorque\n");
3421 int vec = MTOP(MMpull(m));
3422 int bod = MMget(m, 0);
3423 if ((bod == NIL) || (vec == NIL))
3429 SBody * body = MMgetPointer<SBody*>(m, MTOP(bod));
3436 int x = MMfetch(m, vec, 0);
3437 int y = MMfetch(m, vec, 1);
3438 int z = MMfetch(m, vec, 2);
3440 if ((x == NIL) || (y == NIL) || (z == NIL))
3446 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
3448 body->SetTorque(body->GetTorque() + vector);
3449 MMset(m, 0, ITOM(1));
3466 MMechostr(MSKDEBUG,
"SO3BodySetTorque\n");
3469 int vec = MTOP(MMpull(m));
3470 int bod = MMget(m, 0);
3471 if ((bod == NIL) || (vec == NIL))
3477 SBody * body = MMgetPointer<SBody*>(m, MTOP(bod));
3484 int x = MMfetch(m, vec, 0);
3485 int y = MMfetch(m, vec, 1);
3486 int z = MMfetch(m, vec, 2);
3488 if ((x == NIL) || (y == NIL) || (z == NIL))
3494 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
3496 body->SetTorque(vector);
3497 MMset(m, 0, ITOM(1));
3514 MMechostr(MSKDEBUG,
"SO3BodySetOmega\n");
3517 int vec = MTOP(MMpull(m));
3518 int bod = MMget(m, 0);
3519 if ((bod == NIL) || (vec == NIL))
3525 SBody * body = MMgetPointer<SBody*>(m, MTOP(bod));
3532 int x = MMfetch(m, vec, 0);
3533 int y = MMfetch(m, vec, 1);
3534 int z = MMfetch(m, vec, 2);
3536 if ((x == NIL) || (y == NIL) || (z == NIL))
3542 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
3544 body->SetOmega(vector);
3545 MMset(m, 0, ITOM(1));
3562 MMechostr(MSKDEBUG,
"SO3BodySetVelocity\n");
3565 int vec = MTOP(MMpull(m));
3566 int bod = MMget(m, 0);
3567 if ((bod == NIL) || (vec == NIL))
3573 SBody * body = MMgetPointer<SBody*>(m, MTOP(bod));
3580 int x = MMfetch(m, vec, 0);
3581 int y = MMfetch(m, vec, 1);
3582 int z = MMfetch(m, vec, 2);
3584 if ((x == NIL) || (y == NIL) || (z == NIL))
3590 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
3592 body->SetVelocity(vector);
3593 MMset(m, 0, ITOM(1));
3611 MMechostr(MSKDEBUG,
"SO3BodyAddImpulse\n");
3614 int pos = MTOP(MMpull(m));
3615 int deltav = MTOP(MMpull(m));
3616 int bod = MMget(m, 0);
3617 if ((bod == NIL) || (pos == NIL) || (deltav == NIL))
3623 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
3630 int x = MMfetch(m, pos, 0);
3631 int y = MMfetch(m, pos, 1);
3632 int z = MMfetch(m, pos, 2);
3634 if ((x == NIL) || (y == NIL) || (z == NIL))
3640 Ogre::Vector3 position = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
3642 int dx = MMfetch(m, deltav, 0);
3643 int dy = MMfetch(m, deltav, 1);
3644 int dz = MMfetch(m, deltav, 2);
3646 if ((dx == NIL) || (dy == NIL) || (dz == NIL))
3652 Ogre::Vector3 delta = Ogre::Vector3(MTOF(dx), MTOF(dy), MTOF(dz));
3654 body->AddImpulse(delta, position);
3655 MMset(m, 0, ITOM(1));
3676 int stif = MMpull(m);
3677 int src = MMpull(m);
3678 int bod = MMget(m, 0);
3679 if ((bod == NIL) || (src == NIL))
3685 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
3693 int x = MMfetch(m, src, 0);
3694 int y = MMfetch(m, src, 1);
3695 int z = MMfetch(m, src, 2);
3697 if ((x == NIL) || (y == NIL) || (z == NIL))
3703 Ogre::Vector3 dstpos = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
3705 Ogre::Real stiffness = 1.0;
3707 stiffness = MTOF(stif);
3709 if (stiffness <= 0.0f)
3710 stiffness = 0.000001f;
3711 else if (stiffness > 1.0f)
3714 body->MoveToPosition(dstpos, stiffness);
3715 MMset(m, 0, ITOM(1));
3733 MMechostr(MSKDEBUG,
"SO3BodyRotateTo\n");
3736 int stif = MMpull(m);
3738 int bod = MMget(m, 0);
3739 if ((bod == NIL) || (q == NIL))
3745 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
3752 Ogre::Quaternion quat(Ogre::Quaternion::IDENTITY);
3756 int qx = MMfetch(m, q, 0);
3757 int qy = MMfetch(m, q, 1);
3758 int qz = MMfetch(m, q, 2);
3759 int qw = MMfetch(m, q, 3);
3760 quat = Ogre::Quaternion((qw == NIL) ? 0.0f : MTOF(qw), (qx == NIL) ? 0.0f : MTOF(qx), (qy == NIL) ? 0.0f : MTOF(qy), (qz == NIL) ? 0.0f : MTOF(qz));
3763 Ogre::Real stiffness = 1.0;
3765 stiffness = MTOF(stif);
3767 if (stiffness <= 0.0f)
3768 stiffness = 0.000001f;
3769 else if (stiffness > 1.0f)
3772 body->RotateToOrientation(quat, stiffness);
3773 MMset(m, 0, ITOM(1));
3792 MMechostr(MSKDEBUG,
"SO3BodySetPositionOrientation\n");
3795 int rot = MTOP(MMpull(m));
3796 int pos = MTOP(MMpull(m));
3797 int bod = MMget(m, 0);
3798 if ((bod == NIL) || (pos == NIL) || (rot == NIL))
3804 SBody * body = MMgetPointer<SBody*>(m, MTOP(bod));
3811 Ogre::Vector3 vector(MTOF(MMfetch(m, pos, 0)),
3812 MTOF(MMfetch(m, pos, 1)),
3813 MTOF(MMfetch(m, pos, 2)));
3815 Ogre::Quaternion quat(MTOF(MMfetch(m, rot, 0)),
3816 MTOF(MMfetch(m, rot, 1)),
3817 MTOF(MMfetch(m, rot, 2)),
3818 MTOF(MMfetch(m, rot, 3)));
3820 body->SetMatrix(vector, quat);
3821 MMset(m, 0, ITOM(1));
3838 MMechostr(MSKDEBUG,
"SO3BodySetAngularDamping\n");
3841 int vec = MTOP(MMpull(m));
3842 int bod = MMget(m, 0);
3843 if ((bod == NIL) || (vec == NIL))
3849 SBody * body = MMgetPointer<SBody*>(m, MTOP(bod));
3856 int x = MMfetch(m, vec, 0);
3857 int y = MMfetch(m, vec, 1);
3858 int z = MMfetch(m, vec, 2);
3860 if ((x == NIL) || (y == NIL) || (z == NIL))
3866 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
3868 body->SetAngularDamping(vector);
3869 MMset(m, 0, ITOM(1));
3886 MMechostr(MSKDEBUG,
"SO3BodySetCenterOfMass\n");
3889 int vec = MTOP(MMpull(m));
3890 int bod = MMget(m, 0);
3891 if ((bod == NIL) || (vec == NIL))
3897 SBody * body = MMgetPointer<SBody*>(m, MTOP(bod));
3904 int x = MMfetch(m, vec, 0);
3905 int y = MMfetch(m, vec, 1);
3906 int z = MMfetch(m, vec, 2);
3908 if ((x == NIL) || (y == NIL) || (z == NIL))
3914 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
3916 body->SetCenterOfMass(vector);
3917 MMset(m, 0, ITOM(1));
3935 MMechostr(MSKDEBUG,
"SO3BodySetMassMatrix\n");
3938 int vec = MTOP(MMpull(m));
3939 float mass = MTOF(MMpull(m));
3940 int bod = MMget(m, 0);
3941 if ((bod == NIL) || (vec == NIL) || (mass == NIL))
3947 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
3954 int x = MMfetch(m, vec, 0);
3955 int y = MMfetch(m, vec, 1);
3956 int z = MMfetch(m, vec, 2);
3958 if ((x == NIL) || (y == NIL) || (z == NIL))
3964 Ogre::Vector3 vector = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
3966 body->SetMassMatrix(mass, vector);
3967 MMset(m, 0, ITOM(1));
3983 MMechostr(MSKDEBUG,
"SO3BodyGetAngularDamping\n");
3986 int bod = MMget(m, 0);
3993 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4000 Ogre::Vector3 vector = body->GetAngularDamping();
4001 int tuple = MMmalloc(m, 3, TYPETAB);
4008 MMstore(m, tuple, 0, FTOM((vector.x)));
4009 MMstore(m, tuple, 1, FTOM((vector.y)));
4010 MMstore(m, tuple, 2, FTOM((vector.z)));
4011 MMset(m, 0, PTOM(tuple));
4027 MMechostr(MSKDEBUG,
"SO3BodyGetOmega\n");
4030 int bod = MMget(m, 0);
4037 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4044 Ogre::Vector3 vector = body->GetOmega();
4045 int tuple = MMmalloc(m, 3, TYPETAB);
4052 MMstore(m, tuple, 0, FTOM((vector.x)));
4053 MMstore(m, tuple, 1, FTOM((vector.y)));
4054 MMstore(m, tuple, 2, FTOM((vector.z)));
4055 MMset(m, 0, PTOM(tuple));
4072 MMechostr(MSKDEBUG,
"SO3BodySetLinearDamping\n");
4075 int ang = MMpull(m);
4076 int bod = MMget(m, 0);
4077 if ((bod == NIL) || (ang == NIL))
4083 SBody * body = MMgetPointer<SBody*>(m, MTOP(bod));
4090 body->SetLinearDamping((Ogre::Real)MTOF(ang));
4091 MMset(m, 0, ITOM(1));
4108 MMechostr(MSKDEBUG,
"SO3BodySetAutoSleep\n");
4111 int val = MMpull(m);
4112 int bod = MMget(m, 0);
4113 if ((bod == NIL) || (val == NIL))
4119 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4127 if ((val != NIL) && (MTOI(val) == 1))
4130 body->SetAutoSleep(sleep);
4131 MMset(m, 0, ITOM(1));
4148 MMechostr(MSKDEBUG,
"SO3BodySetType\n");
4151 int val = MMpull(m);
4152 int bod = MMget(m, 0);
4153 if ((bod == NIL) || (val == NIL))
4159 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4166 body->SetType(MTOI(val));
4183 MMechostr(MSKDEBUG,
"SO3BodySetIgnoreCollision\n");
4186 int val = MMpull(m);
4187 int bod = MMget(m, 0);
4194 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4205 body->SetIgnoreCollision(state);
4207 MMset(m, 0, ITOM(val));
4222 MMechostr(MSKDEBUG,
"SO3BodyGetIgnoreCollision\n");
4225 int bod = MMget(m, 0);
4232 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4239 bool state = body->GetIgnoreCollision();
4241 MMset(m, 0, state ? ITOM(1) : ITOM(0));
4257 MMechostr(MSKDEBUG,
"SO3BodySetContiniousCollisionMode\n");
4260 int val = MTOI(MMpull(m));
4261 int bod = MMget(m, 0);
4262 if ((bod == NIL) || (val == NIL))
4268 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4279 body->SetContinuousCollisionMode(coll);
4280 MMset(m, 0, ITOM(1));
4297 MMechostr(MSKDEBUG,
"SO3BodySetFluid\n");
4300 int val = MTOI(MMpull(m));
4301 int bod = MMget(m, 0);
4302 if ((bod == NIL) || (val == NIL))
4308 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4319 body->SetFluidState(fluid);
4320 MMset(m, 0, ITOM(1));
4335 MMechostr(MSKDEBUG,
"SO3BodyGetFluid\n");
4338 int bod = MMget(m, 0);
4345 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4352 bool state = body->GetFluidState();
4354 MMset(m, 0, state ? ITOM(1) : ITOM(0));
4371 MMechostr(MSKDEBUG,
"SO3BodySetFluidVolumeRatio\n");
4374 int vol = MMpull(m);
4375 int bod = MMget(m, 0);
4376 if ((bod == NIL) || (vol == NIL))
4382 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4389 float voltowater = MTOF(vol);
4391 body->SetFluidVolumeRatio(voltowater);
4392 MMset(m, 0, ITOM(1));
4407 MMechostr(MSKDEBUG,
"SO3BodyGetFluidVolumeRatio\n");
4410 int bod = MMget(m, 0);
4417 SBody * body = MMgetPointer<SBody*>(m, MTOP(bod));
4424 MMset(m, 0, FTOM(body->GetFluidWaterToVolumeRatio()));
4439 MMechostr(MSKDEBUG,
"SO3BodyCalculateOffset\n");
4442 int bod = MMget(m, 0);
4449 SBody * body = MMgetPointer<SBody*>(m, MTOP(bod));
4456 Ogre::Vector3 vector = body->CalculateBodyOffset();
4457 int tuple = MMmalloc(m, 3, TYPETAB);
4464 MMstore(m, tuple, 0, FTOM((vector.x)));
4465 MMstore(m, tuple, 1, FTOM((vector.y)));
4466 MMstore(m, tuple, 2, FTOM((vector.z)));
4467 MMset(m, 0, PTOM(tuple));
4483 MMechostr(MSKDEBUG,
"SO3BodyGetLinearDamping\n");
4486 int bod = MMget(m, 0);
4493 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4500 float ld = body->GetLinearDamping();
4501 MMset(m, 0, FTOM(ld));
4517 MMechostr(MSKDEBUG,
"SO3BodyGetInvMass\n");
4520 int bod = MMget(m, 0);
4527 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4535 Ogre::Vector3 vector;
4536 body->GetInvMass(mass, vector);
4537 MMpush(m, FTOM(mass));
4539 int inertia = MMmalloc(m, 3, TYPETAB);
4547 MMstore(m, inertia, 0, FTOM(vector.x));
4548 MMstore(m, inertia, 1, FTOM(vector.y));
4549 MMstore(m, inertia, 2, FTOM(vector.z));
4550 MMpush(m, PTOM(inertia));
4553 int result = MMmalloc(m, 2, TYPETAB);
4562 MMstore(m, result, 1, MMpull(m));
4563 MMstore(m, result, 0, MMpull(m));
4564 MMset(m, 0, PTOM(result));
4580 MMechostr(MSKDEBUG,
"SO3BodyGetMassMatrix\n");
4583 int bod = MMget(m, 0);
4590 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4598 Ogre::Vector3 vector;
4599 body->GetMassMatrix(mass, vector);
4600 MMpush(m, FTOM(mass));
4602 int inertia = MMmalloc(m, 3, TYPETAB);
4609 MMstore(m, inertia, 0, FTOM(vector.x));
4610 MMstore(m, inertia, 1, FTOM(vector.y));
4611 MMstore(m, inertia, 2, FTOM(vector.z));
4612 MMpush(m, PTOM(inertia));
4615 int result = MMmalloc(m, 2, TYPETAB);
4623 MMstore(m, result, 1, MMpull(m));
4624 MMstore(m, result, 0, MMpull(m));
4625 MMset(m, 0, PTOM(result));
4641 MMechostr(MSKDEBUG,
"SO3BodyGetAutoSleep\n");
4644 int bod = MMget(m, 0);
4651 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4658 bool sleep = body->GetAutoSleep();
4660 MMset(m, 0, ITOM(sleep ? 1 : 0));
4676 MMechostr(MSKDEBUG,
"SO3BodyGetSleepingState\n");
4679 int bod = MMget(m, 0);
4686 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4693 bool sleep = body->GetSleepState();
4695 MMset(m, 0, ITOM(sleep ? 1 : 0));
4711 MMechostr(MSKDEBUG,
"SO3BodyGetType\n");
4714 int bod = MMget(m, 0);
4721 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4728 int ld = body->GetType();
4729 MMset(m, 0, ITOM(ld));
4745 MMechostr(MSKDEBUG,
"SO3BodyGetContiniousCollisionMode\n");
4748 int bod = MMget(m, 0);
4755 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4762 bool coll = body->GetContinuousCollisionMode();
4763 MMset(m, 0, ITOM(coll ? 1 : 0));
4779 MMechostr(MSKDEBUG,
"SO3BodyGetCenterOfMass\n");
4782 int bod = MMget(m, 0);
4789 SBody * body = MMgetPointer<SBody*>(m, MTOP(bod));
4796 Ogre::Vector3 vector = body->GetCenterOfMass();
4797 int tuple = MMmalloc(m, 3, TYPETAB);
4804 MMstore(m, tuple, 0, FTOM((vector.x)));
4805 MMstore(m, tuple, 1, FTOM((vector.y)));
4806 MMstore(m, tuple, 2, FTOM((vector.z)));
4807 MMset(m, 0, PTOM(tuple));
4823 MMechostr(MSKDEBUG,
"SO3BodyGetVelocity\n");
4826 int bod = MMget(m, 0);
4833 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4840 Ogre::Vector3 vec = body->GetVelocity();
4841 int tuple = MMmalloc(m, 3, TYPETAB);
4848 MMstore(m, tuple, 0, FTOM((vec.x)));
4849 MMstore(m, tuple, 1, FTOM((vec.y)));
4850 MMstore(m, tuple, 2, FTOM((vec.z)));
4851 MMset(m, 0, PTOM(tuple));
4867 MMechostr(MSKDEBUG,
"SO3BodyGetTorque\n");
4870 int bod = MMget(m, 0);
4877 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4884 Ogre::Vector3 vector = body->GetTorque();
4885 int tuple = MMmalloc(m, 3, TYPETAB);
4892 MMstore(m, tuple, 0, FTOM((vector.x)));
4893 MMstore(m, tuple, 1, FTOM((vector.y)));
4894 MMstore(m, tuple, 2, FTOM((vector.z)));
4895 MMset(m, 0, PTOM(tuple));
4913 MMechostr(MSKDEBUG,
"SO3BodyGetPositionOrientation\n");
4916 int bod = MMget(m, 0);
4923 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
4930 Ogre::Vector3 vector;
4931 Ogre::Quaternion quat;
4932 body->GetPositionOrientation(vector, quat);
4934 int position = MMmalloc(m, 3, TYPETAB);
4935 if (position == NIL)
4940 MMstore(m, position, 0, FTOM(vector.x));
4941 MMstore(m, position, 1, FTOM(vector.y));
4942 MMstore(m, position, 2, FTOM(vector.z));
4943 MMpush(m, PTOM(position));
4945 int orientation = MMmalloc(m, 4, TYPETAB);
4946 if (orientation == NIL)
4951 MMstore(m, orientation, 0, FTOM(quat.x));
4952 MMstore(m, orientation, 1, FTOM(quat.y));
4953 MMstore(m, orientation, 2, FTOM(quat.z));
4954 MMstore(m, orientation, 3, FTOM(quat.w));
4955 MMpush(m, PTOM(orientation));
4958 int result = MMmalloc(m, 2, TYPETAB);
4964 MMstore(m, result, 1, MMpull(m));
4965 MMstore(m, result, 0, MMpull(m));
4966 MMset(m, 0, PTOM(result));
4983 MMechostr(MSKDEBUG,
"SO3BodySetFreeze\n");
4986 int val = MTOI(MMpull(m));
4987 int bod = MMget(m, 0);
4994 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
5003 body->SetFreezeState(
true);
5007 body->SetFreezeState(
false);
5009 MMset(m, 0, ITOM(1));
5025 MMechostr(MSKDEBUG,
"SO3BodyGetFreeze\n");
5028 int bod = MMget(m, 0);
5035 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
5043 if (body->GetFreezeState())
5046 MMset(m, 0, MTOI(val));
5063 MMechostr(MSKDEBUG,
"SO3BodySetSimulation\n");
5066 int val = MTOI(MMpull(m));
5067 int bod = MMget(m, 0);
5074 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
5083 body->EnableSimulation(
true);
5087 body->EnableSimulation(
false);
5090 MMset(m, 0, ITOM(1));
5106 MMechostr(MSKDEBUG,
"SO3BodyGetSimulation\n");
5109 int bod = MMget(m, 0);
5116 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
5124 if (body->GetSimulationState())
5127 MMset(m, 0, MTOI(val));
5144 MMechostr(MSKDEBUG,
"SO3BodySetGravityEnable\n");
5147 int val = MTOI(MMpull(m));
5148 int bod = MMget(m, 0);
5155 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
5164 body->SetGravityEnable(
true);
5168 body->SetGravityEnable(
false);
5170 MMset(m, 0, ITOM(1));
5186 MMechostr(MSKDEBUG,
"SO3BodyGetGravityEnable\n");
5189 int bod = MMget(m, 0);
5196 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
5204 if (body->GetGravityEnable())
5207 MMset(m, 0, ITOM(val));
5223 MMechostr(MSKDEBUG,
"SO3BodyGetSceneNode\n");
5226 int bod = MMget(m, 0);
5233 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
5240 int c = OBJfindTH(m,
SO3OBJTYPE, SCOL_PTR(body->GetParentNode()));
5242 c = MMfetch(m, c, OFFOBJMAG);
5260 MMechostr(MSKDEBUG,
"SO3BodyDestroy\n");
5263 int body = MMget(m, 0);
5272 MMset(m, 0, ITOM(1));
5289 MMechostr(MSKDEBUG,
"SO3BodyShowDebug\n");
5292 int istate = MMpull(m);
5293 int ibody = MMget(m, 0);
5300 SBody* body = MMgetPointer<SBody*>(m, MTOP(ibody));
5308 if ((istate != NIL) && (MTOI(istate) > 0))
5311 body->ShowDebug(state);
5313 MMset(m, 0, ITOM(1));
5328 MMechostr(MSKDEBUG,
"SO3SceneNodeGetBody\n");
5331 int n = MMget(m, 0);
5338 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
5345 if (!node->GetParentScene()->GetPhysicsWorld())
5351 if (node->GetSceneNodeBody() == 0)
5357 int mbody = OBJfindTH(m,
SO3PHYSICBODY, SCOL_PTR node->GetSceneNodeBody());
5359 mbody = MMfetch(m, mbody, OFFOBJMAG);
5380 MMechostr(MSKDEBUG,
"SO3PhysicsRayCast\n");
5383 int dist = MMpull(m);
5384 int dir = MTOP(MMpull(m));
5385 int src = MTOP(MMpull(m));
5386 int s = MMget(m, 0);
5387 if ((s == NIL) || (dir == NIL) || (src == NIL) || (dist == NIL))
5393 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
5400 if (!scene->GetPhysicsWorld())
5406 int x1 = MMfetch(m, src, 0);
5407 int y1 = MMfetch(m, src, 1);
5408 int z1 = MMfetch(m, src, 2);
5410 if ((x1 == NIL) || (y1 == NIL) || (z1 == NIL))
5416 Ogre::Vector3 srcVector(MTOF(x1), MTOF(y1), MTOF(z1));
5418 int x2 = MMfetch(m, dir, 0);
5419 int y2 = MMfetch(m, dir, 1);
5420 int z2 = MMfetch(m, dir, 2);
5422 if ((x2 == NIL) || (y2 == NIL) || (z2 == NIL))
5428 Ogre::Vector3 dirVector(MTOF(x2), MTOF(y2), MTOF(z2));
5430 Ogre::Real hitdist = 0;
5431 Ogre::Vector3 hitnormal = Ogre::Vector3::ZERO;
5432 SBody* hitbody = scene->GetPhysicsWorld()->PhysicsRayCast(srcVector, dirVector, MTOF(dist), hitdist, hitnormal);
5443 mbody = MMfetch(m, mbody, OFFOBJMAG);
5449 MMpush(m, FTOM(hitdist));
5452 int tuple = MMmalloc(m, 3, TYPETAB);
5459 MMstore(m, tuple, 0, FTOM((hitnormal.x)));
5460 MMstore(m, tuple, 1, FTOM((hitnormal.y)));
5461 MMstore(m, tuple, 2, FTOM((hitnormal.z)));
5463 MMpush(m, PTOM(tuple));
5466 int result = MMmalloc(m, 3, TYPETAB);
5473 MMstore(m, result, 2, MMpull(m));
5474 MMstore(m, result, 1, MMpull(m));
5475 MMstore(m, result, 0, MMpull(m));
5477 MMset(m, 0, PTOM(result));
5480 MMechostr(MSKDEBUG,
"SO3PhysicsRayCast: OK!\n");
5499 MMechostr(MSKDEBUG,
"SO3PhysicsRayCastExt\n");
5502 int dist = MMpull(m);
5503 int dir = MTOP(MMpull(m));
5504 int src = MTOP(MMpull(m));
5505 int s = MMget(m, 0);
5506 if ((s == NIL) || (dir == NIL) || (src == NIL) || (dist == NIL))
5512 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
5519 if (!scene->GetPhysicsWorld())
5525 int x1 = MMfetch(m, src, 0);
5526 int y1 = MMfetch(m, src, 1);
5527 int z1 = MMfetch(m, src, 2);
5529 if ((x1 == NIL) || (y1 == NIL) || (z1 == NIL))
5535 Ogre::Vector3 srcVector(MTOF(x1), MTOF(y1), MTOF(z1));
5537 int x2 = MMfetch(m, dir, 0);
5538 int y2 = MMfetch(m, dir, 1);
5539 int z2 = MMfetch(m, dir, 2);
5541 if ((x2 == NIL) || (y2 == NIL) || (z2 == NIL))
5548 Ogre::Vector3 dirVector(MTOF(x2), MTOF(y2), MTOF(z2));
5549 std::vector<MRAYINFO> hitbodies = scene->GetPhysicsWorld()->PhysicsRayCast(srcVector, dirVector, MTOF(dist));
5551 for (
unsigned int i = 0; i < hitbodies.size(); i++)
5553 MRAYINFO rinfo = hitbodies[i];
5554 int mbody = OBJfindTH(m,
SO3PHYSICBODY, SCOL_PTR rinfo.body);
5556 mbody = MMfetch(m, mbody, OFFOBJMAG);
5562 MMpush(m, FTOM(rinfo.distance));
5565 int tuple = MMmalloc(m, 3, TYPETAB);
5572 MMstore(m, tuple, 0, FTOM((rinfo.normal.x)));
5573 MMstore(m, tuple, 1, FTOM((rinfo.normal.y)));
5574 MMstore(m, tuple, 2, FTOM((rinfo.normal.z)));
5576 MMpush(m, PTOM(tuple));
5579 int result = MMmalloc(m, 3, TYPETAB);
5586 MMstore(m, result, 2, MMpull(m));
5587 MMstore(m, result, 1, MMpull(m));
5588 MMstore(m, result, 0, MMpull(m));
5590 MMpush(m, PTOM(result));
5596 for (
unsigned int j = 0; j < hitbodies.size(); j++)
5598 if (MMpush(m, 2 * 2))
5600 if (
int k = MBdeftab(m))
5605 MMechostr(MSKDEBUG,
"SO3PhysicsRayCast: OK!\n");
5621 MMechostr(MSKDEBUG,
"SO3PhysicsContraintDestroy\n");
5624 int joint = MMget(m, 0);
5633 MMset(m, 0, ITOM(1));
5650 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetCollisionState\n");
5653 int state = MMpull(m);
5654 int mjoint = MMget(m, 0);
5661 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
5664 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetCollisionState bad joint type.\n");
5669 bool bstate =
false;
5670 if (state != NIL && (MTOI(state) == 1))
5673 joint->SetCollisionState(bstate);
5675 MMset(m, 0, ITOM(1));
5690 MMechostr(MSKDEBUG,
"SO3PhysicsContraintGetCollisionState\n");
5693 int mjoint = MMget(m, 0);
5700 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
5703 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintGetCollisionState bad joint type.\n");
5708 bool bstate = joint->GetCollisionState();
5710 MMset(m, 0, bstate ? ITOM(1) : ITOM(0));
5727 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetStiffness\n");
5730 int val = MMpull(m);
5731 int mjoint = MMget(m, 0);
5738 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
5741 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetStiffness bad joint type.\n");
5746 Ogre::Real value = 1.0f;
5750 joint->SetStiffness(value);
5752 MMset(m, 0, ITOM(1));
5767 MMechostr(MSKDEBUG,
"SO3PhysicsContraintGetStiffness\n");
5770 int mjoint = MMget(m, 0);
5777 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
5780 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintGetStiffness bad joint type.\n");
5785 Ogre::Real value = joint->GetStiffness();
5787 MMset(m, 0, FTOM(value));
5807 MMechostr(MSKDEBUG,
"SO3PhysicsContraintCreateBallAndSocket\n");
5810 int limits = MMpull(m);
5811 int vec = MTOP(MMpull(m));
5812 int parentbod = MMpull(m);
5813 int sonbod = MMpull(m);
5814 int s = MMget(m, 0);
5815 if (s == NIL || sonbod == NIL)
5821 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
5828 SBody* sonBody = MMgetPointer<SBody*>(m, MTOP(sonbod));
5829 if (sonBody == NULL || sonBody->GetParentNode()->GetParentScene() != scene)
5831 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintCreateBallAndSocket bad body to create joint or the body is not in the same scene.\n");
5836 SBody* parentBody = 0;
5837 if (parentbod != NIL)
5838 parentBody = MMgetPointer<SBody*>(m, MTOP(parentbod));
5840 if (parentBody != NULL && parentBody->GetParentNode()->GetParentScene() != scene)
5842 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintCreateBallAndSocket bad body to create joint or the body is not in the same scene.\n");
5847 Ogre::Vector3 position = Ogre::Vector3::ZERO;
5850 int x = MMfetch(m, vec, 0);
5851 int y = MMfetch(m, vec, 1);
5852 int z = MMfetch(m, vec, 2);
5854 if ((x != NIL) && (y != NIL) && (z != NIL))
5855 position = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
5858 bool useLimits =
false;
5859 if (limits != NIL && (MTOI(limits) == 1))
5863 if (scene->GetPhysicsWorld())
5866 scene->GetPhysicsWorld()->AddPhysicContraint(joint);
5871 MMechostr(MSKDEBUG,
"SO3PhysicsContraintCreateBallAndSocket : failed to create joint\n");
5896 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetBallAndSocketLimits\n");
5899 int mtwist = MMpull(m);
5900 int mitwist = MMpull(m);
5901 int mcone = MMpull(m);
5902 int mjoint = MMget(m, 0);
5909 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
5910 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_BALL_AND_SOCKET_CONTRAINT)
5912 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetBallAndSocketLimits bad joint type.\n");
5917 Ogre::Radian maxcone(0.0f);
5919 maxcone = MTOF(mcone);
5921 Ogre::Radian mintwist(0.0f);
5923 mintwist = MTOF(mitwist);
5925 Ogre::Radian maxtwist(0.0f);
5927 maxtwist = MTOF(mtwist);
5931 MMset(m, 0, ITOM(1));
5948 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetBallAndSocketControlled\n");
5951 int ctrl = MMpull(m);
5952 int mjoint = MMget(m, 0);
5959 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
5960 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_BALL_AND_SOCKET_CONTRAINT)
5962 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetBallAndSocketControlled bad joint type.\n");
5967 bool controlled =
false;
5969 controlled = (MTOI(ctrl) > 0) ?
true :
false;
5973 MMset(m, 0, ITOM(1));
5991 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetBallAndSocketAngularVelocity\n");
5994 int val = MMpull(m);
5995 int mjoint = MMget(m, 0);
6002 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
6003 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_BALL_AND_SOCKET_CONTRAINT)
6005 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetBallAndSocketAngularVelocity bad joint type.\n");
6016 MMset(m, 0, ITOM(1));
6034 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetBallAndSocketYawAngle\n");
6037 int val = MMpull(m);
6038 int mjoint = MMget(m, 0);
6045 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
6046 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_BALL_AND_SOCKET_CONTRAINT)
6048 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetBallAndSocketYawAngle bad joint type.\n");
6059 MMset(m, 0, ITOM(1));
6077 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetBallAndSocketPitchAngle\n");
6080 int val = MMpull(m);
6081 int mjoint = MMget(m, 0);
6088 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
6089 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_BALL_AND_SOCKET_CONTRAINT)
6091 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetBallAndSocketPitchAngle bad joint type.\n");
6102 MMset(m, 0, ITOM(1));
6120 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetBallAndSocketRollAngle\n");
6123 int val = MMpull(m);
6124 int mjoint = MMget(m, 0);
6131 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
6132 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_BALL_AND_SOCKET_CONTRAINT)
6134 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetBallAndSocketRollAngle bad joint type.\n");
6145 MMset(m, 0, ITOM(1));
6161 MMechostr(MSKDEBUG,
"SO3PhysicsContraintGetBallAndSocketAngle\n");
6164 int mjoint = MMget(m, 0);
6171 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
6172 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_BALL_AND_SOCKET_CONTRAINT)
6174 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintGetBallAndSocketAngle bad joint type.\n");
6180 int tuple = MMmalloc(m, 3, TYPETAB);
6187 MMstore(m, tuple, 0, FTOM((vec.x)));
6188 MMstore(m, tuple, 1, FTOM((vec.y)));
6189 MMstore(m, tuple, 2, FTOM((vec.z)));
6190 MMset(m, 0, PTOM(tuple));
6207 MMechostr(MSKDEBUG,
"SO3PhysicsContraintGetBallAndSocketOmega\n");
6210 int mjoint = MMget(m, 0);
6217 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
6218 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_BALL_AND_SOCKET_CONTRAINT)
6220 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintGetBallAndSocketOmega bad joint type.\n");
6226 int tuple = MMmalloc(m, 3, TYPETAB);
6233 MMstore(m, tuple, 0, FTOM((vec.x)));
6234 MMstore(m, tuple, 1, FTOM((vec.y)));
6235 MMstore(m, tuple, 2, FTOM((vec.z)));
6236 MMset(m, 0, PTOM(tuple));
6253 MMechostr(MSKDEBUG,
"SO3PhysicsContraintGetBallAndSocketForce\n");
6256 int mjoint = MMget(m, 0);
6263 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
6264 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_BALL_AND_SOCKET_CONTRAINT)
6266 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintGetBallAndSocketForce bad joint type.\n");
6272 int tuple = MMmalloc(m, 3, TYPETAB);
6279 MMstore(m, tuple, 0, FTOM((vec.x)));
6280 MMstore(m, tuple, 1, FTOM((vec.y)));
6281 MMstore(m, tuple, 2, FTOM((vec.z)));
6282 MMset(m, 0, PTOM(tuple));
6304 MMechostr(MSKDEBUG,
"SO3PhysicsContraintCreateHinge\n");
6307 int limits = MMpull(m);
6308 int dir = MTOP(MMpull(m));
6309 int vec = MTOP(MMpull(m));
6310 int parentbod = MMpull(m);
6311 int sonbod = MMpull(m);
6312 int s = MMget(m, 0);
6313 if (s == NIL || sonbod == NIL)
6319 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
6326 SBody* sonBody = MMgetPointer<SBody*>(m, MTOP(sonbod));
6327 if (sonBody == NULL || sonBody->GetParentNode()->GetParentScene() != scene)
6329 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintCreateHinge bad body to create joint or the body is not in the same scene.\n");
6334 SBody* parentBody = 0;
6335 if (parentbod != NIL)
6336 parentBody = MMgetPointer<SBody*>(m, MTOP(parentbod));
6338 if (parentBody != NULL && parentBody->GetParentNode()->GetParentScene() != scene)
6340 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintCreateHinge bad body to create joint or the body is not in the same scene.\n");
6345 Ogre::Vector3 position = Ogre::Vector3::ZERO;
6348 int x = MMfetch(m, vec, 0);
6349 int y = MMfetch(m, vec, 1);
6350 int z = MMfetch(m, vec, 2);
6352 if ((x != NIL) && (y != NIL) && (z != NIL))
6353 position = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
6356 Ogre::Vector3 direction = Ogre::Vector3(0.0f, 1.0f, 0.0f);
6359 int x = MMfetch(m, dir, 0);
6360 int y = MMfetch(m, dir, 1);
6361 int z = MMfetch(m, dir, 2);
6363 if ((x != NIL) && (y != NIL) && (z != NIL))
6364 direction = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
6367 bool useLimits =
false;
6368 if (limits != NIL && (MTOI(limits) == 1))
6372 if (scene->GetPhysicsWorld())
6375 scene->GetPhysicsWorld()->AddPhysicContraint(joint);
6380 MMechostr(MSKDEBUG,
"SO3PhysicsContraintCreateHinge : failed to create joint\n");
6402 MMechostr(MSKDEBUG,
"SO3PhysicsContraintGetHingeAngle\n");
6405 int mjoint = MMget(m, 0);
6412 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
6413 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_HINGE_CONTRAINT)
6415 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintGetHingeAngle bad joint type.\n");
6420 Ogre::Radian value =
static_cast<SHingeContraint*
>(joint)->GetAngle();
6421 MMset(m, 0, FTOM(value.valueRadians()));
6438 MMechostr(MSKDEBUG,
"SO3PhysicsContraintGetHingeOmega\n");
6441 int mjoint = MMget(m, 0);
6448 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
6449 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_HINGE_CONTRAINT)
6451 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintGetHingeOmega bad joint type.\n");
6456 Ogre::Radian value =
static_cast<SHingeContraint*
>(joint)->GetAngularVelocity();
6457 MMset(m, 0, FTOM(value.valueRadians()));
6474 MMechostr(MSKDEBUG,
"SO3PhysicsContraintGetHingeForce\n");
6477 int mjoint = MMget(m, 0);
6484 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
6485 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_HINGE_CONTRAINT)
6487 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintGetHingeForce bad joint type.\n");
6493 int tuple = MMmalloc(m, 3, TYPETAB);
6500 MMstore(m, tuple, 0, FTOM((vec.x)));
6501 MMstore(m, tuple, 1, FTOM((vec.y)));
6502 MMstore(m, tuple, 2, FTOM((vec.z)));
6503 MMset(m, 0, PTOM(tuple));
6519 if (!scene->GetPhysicsWorld())
6522 SMaterialIDMap::iterator iMaterialIDSearched = scene->GetPhysicsWorld()->listOfMaterialID.find(testName);
6523 if (iMaterialIDSearched != scene->GetPhysicsWorld()->listOfMaterialID.end())
6525 *result = iMaterialIDSearched->second;
6545 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetHingeLimits\n");
6548 int maangle = MMpull(m);
6549 int miangle = MMpull(m);
6550 int mjoint = MMget(m, 0);
6557 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
6558 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_HINGE_CONTRAINT)
6560 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetHingeLimits bad joint type.\n");
6565 Ogre::Radian minangle(0.0f);
6567 minangle = MTOF(miangle);
6569 Ogre::Radian maxangle(0.0f);
6571 maxangle = MTOF(maangle);
6575 MMset(m, 0, ITOM(1));
6593 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetHingeAngle\n");
6596 int mafrict = MMpull(m);
6597 int mifrict = MMpull(m);
6598 int ang = MMpull(m);
6599 int mjoint = MMget(m, 0);
6606 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
6607 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_HINGE_CONTRAINT)
6609 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetHingeMotorAngle bad joint type.\n");
6614 Ogre::Radian angle(0.0f);
6618 Ogre::Real minFriction = 0.0f;
6620 minFriction = MTOF(mifrict);
6622 Ogre::Real maxFriction = 0.0f;
6624 maxFriction = MTOF(mafrict);
6626 static_cast<SHingeContraint*
>(joint)->SetMotorAngle(angle, minFriction, maxFriction);
6628 MMset(m, 0, ITOM(1));
6645 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetHingeMotorOmega\n");
6648 int stre = MMpull(m);
6649 int ang = MMpull(m);
6650 int mjoint = MMget(m, 0);
6657 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
6658 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_HINGE_CONTRAINT)
6660 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetHingeMotorOmega bad joint type.\n");
6665 Ogre::Radian angle(0.0f);
6669 Ogre::Real strength = 0.5f;
6671 strength = MTOF(stre);
6673 if (strength > 1.0f)
6678 MMset(m, 0, ITOM(1));
6695 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetHingeTorque\n");
6698 int torq = MMpull(m);
6699 int mjoint = MMget(m, 0);
6706 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
6707 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_HINGE_CONTRAINT)
6709 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetHingeTorque bad joint type.\n");
6714 Ogre::Real torque = 0.0f;
6716 torque = MTOF(torq);
6720 MMset(m, 0, ITOM(1));
6736 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetHingeBrake\n");
6739 int forc = MMpull(m);
6740 int mjoint = MMget(m, 0);
6747 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
6748 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_HINGE_CONTRAINT)
6750 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetHingeBrake bad joint type.\n");
6755 Ogre::Real force = -1.0f;
6761 MMset(m, 0, ITOM(1));
6778 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetHingeMotorEnable\n");
6781 int state = MMpull(m);
6782 int mjoint = MMget(m, 0);
6789 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
6790 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_HINGE_CONTRAINT)
6792 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetHingeMotorEnable bad joint type.\n");
6797 bool enable =
false;
6798 if ((state != NIL) && (MTOI(state) == 1))
6803 MMset(m, 0, ITOM(1));
6825 MMechostr(MSKDEBUG,
"SO3PhysicsContraintCreateSlider\n");
6828 int spring = MMpull(m);
6829 int limits = MMpull(m);
6830 int dir = MTOP(MMpull(m));
6831 int vec = MTOP(MMpull(m));
6832 int parentbod = MMpull(m);
6833 int sonbod = MMpull(m);
6834 int s = MMget(m, 0);
6835 if (s == NIL || sonbod == NIL)
6841 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
6848 SBody* sonBody = MMgetPointer<SBody*>(m, MTOP(sonbod));
6849 if (sonBody == NULL || sonBody->GetParentNode()->GetParentScene() != scene)
6851 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintCreateSlider bad body to create joint or the body is not in the same scene.\n");
6856 SBody* parentBody = 0;
6857 if (parentbod != NIL)
6858 parentBody = MMgetPointer<SBody*>(m, MTOP(parentbod));
6860 if (parentBody != NULL && parentBody->GetParentNode()->GetParentScene() != scene)
6862 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintCreateSlider bad body to create joint or the body is not in the same scene.\n");
6867 Ogre::Vector3 position = Ogre::Vector3::ZERO;
6870 int x = MMfetch(m, vec, 0);
6871 int y = MMfetch(m, vec, 1);
6872 int z = MMfetch(m, vec, 2);
6874 if ((x != NIL) && (y != NIL) && (z != NIL))
6875 position = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
6878 Ogre::Vector3 direction = Ogre::Vector3(0.0f, 1.0f, 0.0f);
6881 int x = MMfetch(m, dir, 0);
6882 int y = MMfetch(m, dir, 1);
6883 int z = MMfetch(m, dir, 2);
6885 if ((x != NIL) && (y != NIL) && (z != NIL))
6886 direction = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
6888 if (direction == Ogre::Vector3::ZERO)
6889 direction = Ogre::Vector3::UNIT_Y;
6891 bool useLimits =
false;
6892 if (limits != NIL && (MTOI(limits) == 1))
6895 bool useSpring =
false;
6896 if (spring != NIL && (MTOI(spring) == 1))
6900 if (scene->GetPhysicsWorld())
6903 scene->GetPhysicsWorld()->AddPhysicContraint(joint);
6908 MMechostr(MSKDEBUG,
"SO3PhysicsContraintCreateSlider : failed to create joint\n");
6930 MMechostr(MSKDEBUG,
"SO3PhysicsContraintGetSliderVelocity\n");
6933 int mjoint = MMget(m, 0);
6940 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
6941 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_SLIDER_CONTRAINT)
6943 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintGetSliderVelocity bad joint type.\n");
6949 MMset(m, 0, FTOM(value));
6966 MMechostr(MSKDEBUG,
"SO3PhysicsContraintGetSliderForce\n");
6969 int mjoint = MMget(m, 0);
6976 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
6977 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_SLIDER_CONTRAINT)
6979 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintGetSliderForce bad joint type.\n");
6985 int tuple = MMmalloc(m, 3, TYPETAB);
6992 MMstore(m, tuple, 0, FTOM((vec.x)));
6993 MMstore(m, tuple, 1, FTOM((vec.y)));
6994 MMstore(m, tuple, 2, FTOM((vec.z)));
6995 MMset(m, 0, PTOM(tuple));
7012 MMechostr(MSKDEBUG,
"SO3PhysicsContraintGetSliderPosition\n");
7015 int mjoint = MMget(m, 0);
7022 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
7023 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_SLIDER_CONTRAINT)
7025 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintGetSliderPosition bad joint type.\n");
7031 MMset(m, 0, FTOM(pos));
7050 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetSliderLimits\n");
7053 int madist = MMpull(m);
7054 int midist = MMpull(m);
7055 int mjoint = MMget(m, 0);
7062 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
7063 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_SLIDER_CONTRAINT)
7065 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetSliderLimits bad joint type.\n");
7070 Ogre::Real mindist(0.0f);
7072 mindist = MTOF(midist);
7074 Ogre::Real maxdist(0.0f);
7076 maxdist = MTOF(madist);
7080 MMset(m, 0, ITOM(1));
7098 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetSliderSpring\n");
7101 int spdamp = MMpull(m);
7102 int spstrength = MMpull(m);
7103 int mjoint = MMget(m, 0);
7110 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
7111 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_SLIDER_CONTRAINT)
7113 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetSliderSpring bad joint type.\n");
7118 Ogre::Real springStrength(0.0f);
7119 if (spstrength != NIL)
7120 springStrength = MTOF(spstrength);
7122 Ogre::Real springDamping(0.0f);
7124 springDamping = MTOF(spdamp);
7126 static_cast<SSliderContraint*
>(joint)->SetSpring(springStrength, springDamping);
7128 MMset(m, 0, ITOM(1));
7145 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetSliderFriction\n");
7148 int sfriction = MMpull(m);
7149 int mjoint = MMget(m, 0);
7156 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
7157 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_SLIDER_CONTRAINT)
7159 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetSliderFriction bad joint type.\n");
7164 Ogre::Real friction(0.0f);
7165 if (sfriction != NIL)
7166 friction = MTOF(sfriction);
7170 MMset(m, 0, ITOM(1));
7186 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetSliderMotorEnable\n");
7189 int state = MMpull(m);
7190 int mjoint = MMget(m, 0);
7197 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
7198 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_SLIDER_CONTRAINT)
7200 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetSliderMotorEnable bad joint type.\n");
7205 bool enable =
false;
7206 if ((state != NIL) && (MTOI(state) == 1))
7211 MMset(m, 0, ITOM(1));
7228 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetSliderMotorVelocity\n");
7231 int stre = MMpull(m);
7232 int velo = MMpull(m);
7233 int mjoint = MMget(m, 0);
7240 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
7241 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_SLIDER_CONTRAINT)
7243 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetSliderMotorVelocity bad joint type.\n");
7248 Ogre::Real velocity(0.0f);
7250 velocity = MTOF(velo);
7252 Ogre::Real strength = 0.5f;
7254 strength = MTOF(stre);
7256 if (strength > 1.0f)
7259 static_cast<SSliderContraint*
>(joint)->SetMotorVelocity(velocity, strength);
7261 MMset(m, 0, ITOM(1));
7278 MMechostr(MSKDEBUG,
"SO3PhysicsContraintCreateVehicle\n");
7281 int sonbod = MMpull(m);
7282 int s = MMget(m, 0);
7283 if (s == NIL || sonbod == NIL)
7289 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
7296 SBody* sonBody = MMgetPointer<SBody*>(m, MTOP(sonbod));
7297 if (sonBody == NULL || sonBody->GetParentNode()->GetParentScene() != scene)
7299 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintCreateVehicle bad body to create joint or the body is not in the same scene.\n");
7305 if (scene->GetPhysicsWorld())
7308 scene->GetPhysicsWorld()->AddPhysicContraint(joint);
7313 MMechostr(MSKDEBUG,
"SO3PhysicsContraintCreateVehicle : failed to create joint\n");
7345 MMechostr(MSKDEBUG,
"SO3PhysicsContraintAddVehicleTire\n");
7348 int idriving = MMpull(m);
7349 int isteer = MMpull(m);
7350 int isusshock = MMpull(m);
7351 int isusspring = MMpull(m);
7352 int isuslength = MMpull(m);
7353 int ifriction = MMpull(m);
7354 int iwidth = MMpull(m);
7355 int iradius = MMpull(m);
7356 int imass = MMpull(m);
7357 int inode = MMpull(m);
7358 int mjoint = MMget(m, 0);
7359 if ((mjoint == NIL) || (inode == NIL))
7365 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
7366 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_VEHICLE_CONTRAINT)
7368 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintAddVehicleTire bad joint type.\n");
7373 SNode* node = MMgetPointer<SNode*>(m, MTOP(inode));
7380 Ogre::Real mass(1.0f);
7384 Ogre::Real radius(0.0f);
7386 radius = MTOF(iradius);
7388 Ogre::Real width(0.1f);
7390 width = MTOF(iwidth);
7392 Ogre::Real friction(1.0f);
7393 if (ifriction != NIL)
7394 friction = MTOF(ifriction);
7396 Ogre::Real suslength(0.0f);
7397 if (isuslength != NIL)
7398 suslength = MTOF(isuslength);
7400 Ogre::Real susspring(0.0f);
7401 if (isusspring != NIL)
7402 susspring = MTOF(isusspring);
7404 Ogre::Real susshock(0.0f);
7405 if (isusshock != NIL)
7406 susshock = MTOF(isusshock);
7408 bool bsteer =
false;
7409 if ((isteer != NIL) && (MTOI(isteer) == 1))
7412 bool bdriving =
false;
7413 if ((idriving != NIL) && (MTOI(idriving) == 1))
7416 static_cast<SVehicleContraint*
>(joint)->AddTire(node, mass, radius, width, friction, suslength, susspring, susshock, bsteer, bdriving);
7418 MMset(m, 0, ITOM(1));
7434 MMechostr(MSKDEBUG,
"SO3PhysicsContraintGetVehicleSpeed\n");
7437 int mjoint = MMget(m, 0);
7444 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
7445 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_VEHICLE_CONTRAINT)
7447 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintGetVehicleSpeed bad joint type.\n");
7453 MMset(m, 0, FTOM(speed));
7471 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetVehicleSteerAngle\n");
7474 int iangle = MMpull(m);
7475 int mjoint = MMget(m, 0);
7482 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
7483 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_VEHICLE_CONTRAINT)
7485 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetVehicleSteerAngle bad joint type.\n");
7490 Ogre::Radian angle(0.0f);
7492 angle = Ogre::Radian(MTOF(iangle));
7496 MMset(m, 0, ITOM(1));
7513 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetVehicleDrivingTorque\n");
7516 int itorque = MMpull(m);
7517 int mjoint = MMget(m, 0);
7524 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
7525 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_VEHICLE_CONTRAINT)
7527 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetVehicleDrivingTorque bad joint type.\n");
7532 Ogre::Radian torque(0.0f);
7534 torque = Ogre::Radian(MTOF(itorque));
7538 MMset(m, 0, ITOM(1));
7555 MMechostr(MSKDEBUG,
"SO3PhysicsContraintSetVehicleBrake\n");
7558 int ibrake = MMpull(m);
7559 int mjoint = MMget(m, 0);
7566 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
7567 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_VEHICLE_CONTRAINT)
7569 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintSetVehicleBrake bad joint type.\n");
7574 Ogre::Real brake(0.0f);
7576 brake = MTOF(ibrake);
7580 MMset(m, 0, ITOM(1));
7596 MMechostr(MSKDEBUG,
"SO3PhysicsContraintGetVehicleOnAir\n");
7599 int mjoint = MMget(m, 0);
7606 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
7607 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_VEHICLE_CONTRAINT)
7609 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintGetVehicleOnAir bad joint type.\n");
7614 MMset(m, 0, ITOM(
static_cast<SVehicleContraint*
>(joint)->GetVehicleOnAir() ? 1 : 0));
7631 MMechostr(MSKDEBUG,
"SO3PhysicsContraintGetVehicleTireAngularVelocity\n");
7634 int inode = MMpull(m);
7635 int mjoint = MMget(m, 0);
7636 if ((mjoint == NIL) || (inode == NIL))
7642 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
7643 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_VEHICLE_CONTRAINT)
7645 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintGetVehicleTireAngularVelocity bad joint type.\n");
7650 SNode* node = MMgetPointer<SNode*>(m, MTOP(inode));
7657 MMset(m, 0, FTOM(
static_cast<SVehicleContraint*
>(joint)->GetTireAngularVelocity(node)));
7674 MMechostr(MSKDEBUG,
"SO3PhysicsContraintGetVehicleTireOnAir\n");
7677 int inode = MMpull(m);
7678 int mjoint = MMget(m, 0);
7679 if ((mjoint == NIL) || (inode == NIL))
7685 SPhysicContraint* joint = MMgetPointer<SPhysicContraint*>(m, MTOP(mjoint));
7686 if (joint == NULL || joint->GetType() != SPhysicContraint::SO3_VEHICLE_CONTRAINT)
7688 MMechostr(MSKRUNTIME,
"SO3PhysicsContraintGetVehicleTireOnAir bad joint type.\n");
7693 SNode* node = MMgetPointer<SNode*>(m, MTOP(inode));
7700 int state = (
static_cast<SVehicleContraint*
>(joint)->GetTireOnAir(node)) ? 1 : 0;
7701 MMset(m, 0, ITOM(state));
7716 SMaterialPairMap::iterator iMaterialPairList = world->listOfPhysicsMaterialPair.begin();
7717 while (iMaterialPairList != world->listOfPhysicsMaterialPair.end())
7719 if (((*iMaterialPairList)->getID1() == ID1 && (*iMaterialPairList)->getID2() == ID2) || ((*iMaterialPairList)->getID2() == ID1 && (*iMaterialPairList)->getID1() == ID2))
7720 return (*iMaterialPairList);
7722 iMaterialPairList++;
7741 MMechostr(MSKDEBUG,
"SO3BodySetMaterial\n");
7744 int mat = MMpull(m);
7745 int bod = MMget(m, 0);
7746 if ((bod == NIL) || (mat == NIL))
7752 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
7759 SMaterialID* matID = MMgetPointer<SMaterialID*>(m, MTOP(mat));
7766 body->SetMaterialID(matID);
7767 MMset(m, 0, ITOM(1));
7770 MMechostr(MSKDEBUG,
"SO3BodySetMaterial: OK!\n");
7787 MMechostr(MSKDEBUG,
"SO3BodyGetMaterial\n");
7790 int bod = MMget(m, 0);
7793 MMechostr(MSKDEBUG,
"SO3BodyGetMaterial: one of the parameters is NIL!!\n");
7798 SBody* body = MMgetPointer<SBody*>(m, MTOP(bod));
7805 const SMaterialID* matID = body->GetMaterial();
7814 mat = MMfetch(m, mat, OFFOBJMAG);
7834 MMechostr(MSKDEBUG,
"SO3PhysicsMaterialCreate\n");
7837 int nam = MMpull(m);
7838 int s = MMget(m, 0);
7839 if ((s == NIL) || (nam == NIL))
7845 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
7852 if (!scene->GetPhysicsWorld())
7858 string name = MMstartstr(m, MTOP(nam));
7871 a = MMfetch(m, a, OFFOBJMAG);
7881 matID = scene->GetPhysicsWorld()->CreatePhysicMaterialID(name);
7884 SMaterialIDMap::iterator iMaterialIDList = scene->GetPhysicsWorld()->listOfMaterialID.begin();
7885 while (iMaterialIDList != scene->GetPhysicsWorld()->listOfMaterialID.end())
7887 SMaterialPair* matPair = scene->GetPhysicsWorld()->CreatePhysicMaterialPair(matID, iMaterialIDList->second);
7897 MMechostr(MSKDEBUG,
"SO3PhysicsMaterialCreate : OK!\n");
7914 MMechostr(MSKDEBUG,
"SO3PhysicsMaterialDestroy\n");
7917 int mat = MMget(m, 0);
7927 MMset(m, 0, ITOM(1));
7929 MMechostr(MSKDEBUG,
"SO3PhysicsMaterialDestroy : OK!\n");
7947 MMechostr(MSKDEBUG,
"SO3PhysicsGetMaterial\n");
7950 int name = MMpull(m);
7951 int s = MMget(m, 0);
7952 if ((s == NIL) || (name == NIL))
7954 MMechostr(MSKDEBUG,
"SO3PhysicsGetMaterial: one of the parameters is NIL!!\n");
7959 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
7966 if (!scene->GetPhysicsWorld())
7972 string matname = MMstartstr(m, MTOP(name));
7974 MMechostr(MSKDEBUG,
"Material Name : %s \n", matname.c_str());
7977 if (matname.empty())
7983 SMaterialID* matID = NULL;
7984 SMaterialIDMap::iterator iMaterialIDSearched = scene->GetPhysicsWorld()->listOfMaterialID.find(matname);
7985 if (iMaterialIDSearched != scene->GetPhysicsWorld()->listOfMaterialID.end())
7986 matID = iMaterialIDSearched->second;
7990 MMechostr(MSKDEBUG,
"Physic material not found %s\n", matname.c_str());
7997 mat = MMfetch(m, mat, OFFOBJMAG);
8015 MMechostr(MSKDEBUG,
"SO3PhysicsGetMaterialName\n");
8018 int mat = MMget(m, 0);
8021 MMechostr(MSKDEBUG,
"SO3PhysicsGetMaterialName: one of the parameters is NIL!!\n");
8026 SMaterialID* matID = MMgetPointer<SMaterialID*>(m, MTOP(mat));
8034 Mpushstrbloc(m, (
char*)matID->GetName().c_str());
8051 MMechostr(MSKDEBUG,
"SO3PhysicsMaterialSetSurfaceThickness\n");
8054 int val = MMpull(m);
8055 int mat2 = MMpull(m);
8056 int mat1 = MMget(m, 0);
8057 if ((mat1 == NIL) || (mat2 == NIL) || (val == NIL))
8063 SMaterialID* matID1 = MMgetPointer<SMaterialID*>(m, MTOP(mat1));
8070 SMaterialID* matID2 = MMgetPointer<SMaterialID*>(m, MTOP(mat2));
8078 SMaterialPair* matPair =
getMaterialPairByWorld(matID1->GetParentWorld(), matID1->getID(), matID2->getID());
8079 if (matPair == NULL)
8085 matPair->SetDefaultSurfaceThickness((Ogre::Real)(MTOF(val)));
8086 MMset(m, 0, ITOM(1));
8088 MMechostr(MSKDEBUG,
"SO3PhysicsMaterialSetSurfaceThickness : OK!\n");
8107 MMechostr(MSKDEBUG,
"SO3PhysicsMaterialSetDefaultElasticity\n");
8110 int val = MMpull(m);
8111 int mat2 = MMpull(m);
8112 int mat1 = MMget(m, 0);
8113 if ((mat1 == NIL) || (mat2 == NIL) || (val == NIL))
8115 MMechostr(MSKDEBUG,
"One of Paramter is NIL!!\n");
8120 SMaterialID* matID1 = MMgetPointer<SMaterialID*>(m, MTOP(mat1));
8123 MMechostr(MSKDEBUG,
"MatID1 is NULL!!\n");
8128 SMaterialID* matID2 = MMgetPointer<SMaterialID*>(m, MTOP(mat2));
8131 MMechostr(MSKDEBUG,
"MatID1 is NULL!!\n");
8137 SMaterialPair* matPair;
8139 if (matPair == NULL)
8141 MMechostr(MSKDEBUG,
"MAtPair is NULL!!\n");
8145 matPair->SetDefaultElasticity((Ogre::Real)(MTOF(val)));
8147 MMset(m, 0, ITOM(1));
8149 MMechostr(MSKDEBUG,
"SO3PhysicsMaterialSetDefaultElasticity : OK!\n");
8169 MMechostr(MSKDEBUG,
"SO3PhysicsMaterialSetDefaultFriction\n");
8172 int val2 = MMpull(m);
8173 int val1 = MMpull(m);
8174 int mat2 = MMpull(m);
8175 int mat1 = MMget(m, 0);
8176 if ((mat1 == NIL) || (mat2 == NIL) || (val1 == NIL) || (val2 == NIL))
8182 SMaterialID* matID1 = MMgetPointer<SMaterialID*>(m, MTOP(mat1));
8189 SMaterialID* matID2 = MMgetPointer<SMaterialID*>(m, MTOP(mat2));
8197 SMaterialPair* matPair =
getMaterialPairByWorld(matID1->GetParentWorld(), matID1->getID(), matID2->getID());
8198 if (matPair == NULL)
8203 matPair->SetDefaultFriction((Ogre::Real)(MTOF(val1)), (Ogre::Real)(MTOF(val2)));
8205 MMset(m, 0, ITOM(1));
8223 MMechostr(MSKDEBUG,
"SO3PhysicsMaterialSetDefaultSoftness\n");
8226 int val = MMpull(m);
8227 int mat2 = MMpull(m);
8228 int mat1 = MMget(m, 0);
8229 if ((mat1 == NIL) || (mat2 == NIL) || (val == NIL))
8231 MMechostr(MSKDEBUG,
"One of Paramter is NIL!!\n");
8236 SMaterialID* matID1 = MMgetPointer<SMaterialID*>(m, MTOP(mat1));
8243 SMaterialID* matID2 = MMgetPointer<SMaterialID*>(m, MTOP(mat2));
8251 SMaterialPair* matPair =
getMaterialPairByWorld(matID1->GetParentWorld(), matID1->getID(), matID2->getID());
8252 if (matPair == NULL)
8257 matPair->SetDefaultSoftness((Ogre::Real)(MTOF(val)));
8259 MMset(m, 0, ITOM(1));
8277 MMechostr(MSKDEBUG,
"SO3PhysicsMaterialSetDefaultCollidable\n");
8280 int val = MMpull(m);
8281 int mat2 = MMpull(m);
8282 int mat1 = MMget(m, 0);
8283 if ((mat1 == NIL) || (mat2 == NIL) || (val == NIL))
8285 MMechostr(MSKDEBUG,
"One of Paramter is NIL!!\n");
8290 SMaterialID* matID1 = MMgetPointer<SMaterialID*>(m, MTOP(mat1));
8297 SMaterialID* matID2 = MMgetPointer<SMaterialID*>(m, MTOP(mat2));
8305 SMaterialPair* matPair =
getMaterialPairByWorld(matID1->GetParentWorld(), matID1->getID(), matID2->getID());
8306 if (matPair == NULL)
8316 matPair->SetDefaultCollidable(coll);
8318 MMset(m, 0, ITOM(1));
8337 MMechostr(MSKDEBUG,
"SO3PhysicsMaterialSetContiniousCollisionMode\n");
8339 int val = MMpull(m);
8340 int mat2 = MMpull(m);
8341 int mat1 = MMget(m, 0);
8361 MMechostr(MSKDEBUG,
"SO3WorldApplyImpulsePoint\n");
8364 int istrength = MMpull(m);
8365 int iradius = MMpull(m);
8366 int vec = MTOP(MMpull(m));
8367 int s = MMget(m, 0);
8368 if ((s == NIL) || (vec == NIL))
8374 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
8381 int x = MMfetch(m, vec, 0);
8382 int y = MMfetch(m, vec, 1);
8383 int z = MMfetch(m, vec, 2);
8385 if ((x == NIL) || (y == NIL) || (z == NIL))
8391 if (!scene->GetPhysicsWorld())
8397 Ogre::Vector3 position = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
8398 Ogre::Real radius = 1.0f;
8400 radius = MTOF(iradius);
8402 Ogre::Real strength = 1.0f;
8403 if (istrength != NIL)
8404 strength = MTOF(istrength);
8406 scene->GetPhysicsWorld()->ApplyImpulsePoint(position, radius, strength);
8407 MMset(m, 0, ITOM(1));
8432 MMechostr(MSKDEBUG,
"SO3CbMaterialCollision\n");
8436 int pUser = MMpull(m);
8437 int pCbk = MMpull(m);
8438 int mat2 = MMpull(m);
8439 int mat1 = MMpull(m);
8444 MMechostr(0,
"SO3CbMaterialCollision error : mat1 is nil...\n");
8452 MMechostr(0,
"SO3CbMaterialCollision error : mat2 is nil...\n");
8457 SMaterialID* matID1 = MMgetPointer<SMaterialID*>(m, MTOP(mat1));
8464 SMaterialID* matID2 = MMgetPointer<SMaterialID*>(m, MTOP(mat2));
8472 SMaterialPair* matPair =
getMaterialPairByWorld(matID1->GetParentWorld(), matID1->getID(), matID2->getID());
8473 if (matPair == NULL)
8481 matPair->SetContactCallbackActivated(
false);
8485 matPair->SetContactCallbackActivated(
true);
8491 matPair->SetContactCallbackActivated(
false);
8507 MMset(m, 0, ITOM(1));
8510 MMechostr(MSKDEBUG,
"SO3CbMaterialCollision : OK!\n");
8533 MMechostr(MSKDEBUG,
"SO3CbMaterialOverlapStarted\n");
8537 int pUser = MMpull(m);
8538 int pCbk = MMpull(m);
8539 int mat2 = MMpull(m);
8540 int mat1 = MMpull(m);
8545 MMechostr(0,
"SO3CbMaterialOverlapStarted error : mat1 is nil...\n");
8553 MMechostr(0,
"SO3CbMaterialOverlapStarted error : mat2 is nil...\n");
8558 SMaterialID* matID1 = MMgetPointer<SMaterialID*>(m, MTOP(mat1));
8565 SMaterialID* matID2 = MMgetPointer<SMaterialID*>(m, MTOP(mat2));
8573 SMaterialPair* matPair =
getMaterialPairByWorld(matID1->GetParentWorld(), matID1->getID(), matID2->getID());
8574 if (matPair == NULL)
8582 matPair->SetOverlapStartedCallbackActivated(
false);
8586 matPair->SetOverlapStartedCallbackActivated(
true);
8592 matPair->SetOverlapStartedCallbackActivated(
false);
8608 MMset(m, 0, ITOM(1));
8611 MMechostr(MSKDEBUG,
"SO3CbMaterialOverlapStarted : OK!\n");
8634 MMechostr(MSKDEBUG,
"SO3CbMaterialOverlapEnded\n");
8638 int pUser = MMpull(m);
8639 int pCbk = MMpull(m);
8640 int mat2 = MMpull(m);
8641 int mat1 = MMpull(m);
8646 MMechostr(0,
"SO3CbMaterialOverlapStarted error : mat1 is nil...\n");
8654 MMechostr(0,
"SO3CbMaterialOverlapStarted error : mat2 is nil...\n");
8659 SMaterialID* matID1 = MMgetPointer<SMaterialID*>(m, MTOP(mat1));
8666 SMaterialID* matID2 = MMgetPointer<SMaterialID*>(m, MTOP(mat2));
8674 SMaterialPair* matPair =
getMaterialPairByWorld(matID1->GetParentWorld(), matID1->getID(), matID2->getID());
8675 if (matPair == NULL)
8683 matPair->SetOverlapEndedCallbackActivated(
false);
8687 matPair->SetOverlapEndedCallbackActivated(
true);
8693 matPair->SetOverlapEndedCallbackActivated(
false);
8709 MMset(m, 0, ITOM(1));
8712 MMechostr(MSKDEBUG,
"SO3CbMaterialOverlapEnded : OK!\n");
8734 MMechostr(MSKDEBUG,
"SO3CbBodyLeaveWorld\n");
8745 {
"SO3_TYPE_BODY_BOX", TYPVAR,
"I", SCOL_TYPTYPE(SShape::SO3_BOX_COLLISION) },
8746 {
"SO3_TYPE_BODY_CONE", TYPVAR,
"I", SCOL_TYPTYPE(SShape::SO3_CONE_COLLISION) },
8747 {
"SO3_TYPE_BODY_ELLIPSOID", TYPVAR,
"I", SCOL_TYPTYPE(SShape::SO3_ELLIPSOID_COLLISION) },
8748 {
"SO3_TYPE_BODY_CAPSULE", TYPVAR,
"I", SCOL_TYPTYPE(SShape::SO3_CAPSULE_COLLISION) },
8749 {
"SO3_TYPE_BODY_CYLINDER", TYPVAR,
"I", SCOL_TYPTYPE(SShape::SO3_CYLINDER_COLLISION) },
8750 {
"SO3_TYPE_BODY_COMPOUND", TYPVAR,
"I", SCOL_TYPTYPE(SShape::SO3_COMPOUND_COLLISION) },
8751 {
"SO3_TYPE_BODY_CHAMFERCYLINDRE", TYPVAR,
"I", SCOL_TYPTYPE(SShape::SO3_CHAMFERCYLINDRE_COLLISION)},
8752 {
"SO3_TYPE_BODY_PYRAMID", TYPVAR,
"I", SCOL_TYPTYPE(SShape::SO3_PYRAMID_COLLISION) },
8753 {
"SO3_TYPE_BODY_SHAPE", TYPVAR,
"I", SCOL_TYPTYPE(SShape::SO3_SHAPE_COLLISION) },
8754 {
"SO3_TYPE_BODY_CONCAVE", TYPVAR,
"I", SCOL_TYPTYPE(SShape::SO3_CONCAVE_COLLISION) },
8755 {
"SO3_TYPE_BODY_TREE", TYPVAR,
"I", SCOL_TYPTYPE(SShape::SO3_TREE_COLLISION) },
8757 {
"SO3WorldSetSize", 3,
"fun [SO3_SCENE [F F F] [F F F]] I",
SO3WorldSetSize },
8772 {
"SO3BodyCreateBox", 2,
"fun [SO3_OBJECT [F F F]] SO3_PHYSICBODY",
SO3BodyCreateBox },
8776 {
"SO3BodyCreateCone", 3,
"fun [SO3_OBJECT F F] SO3_PHYSICBODY",
SO3BodyCreateCone },
8778 {
"SO3BodyCreatePyramid", 2,
"fun [SO3_OBJECT [F F F]] SO3_PHYSICBODY",
SO3BodyCreatePyramid },
8779 {
"SO3BodyCreateBoxExt", 4,
"fun [SO3_OBJECT [F F F] [F F F] [F F F F]] SO3_PHYSICBODY",
SO3BodyCreateBoxExt },
8780 {
"SO3BodyCreateEllipsoidExt", 4,
"fun [SO3_OBJECT [F F F] [F F F] [F F F F]] SO3_PHYSICBODY",
SO3BodyCreateEllipsoidExt },
8781 {
"SO3BodyCreateCapsuleExt", 5,
"fun [SO3_OBJECT F F [F F F] [F F F F]] SO3_PHYSICBODY",
SO3BodyCreateCapsuleExt },
8783 {
"SO3BodyCreateConeExt", 5,
"fun [SO3_OBJECT F F [F F F] [F F F F]] SO3_PHYSICBODY",
SO3BodyCreateConeExt },
8784 {
"SO3BodyCreateCylinderExt", 5,
"fun [SO3_OBJECT F F [F F F] [F F F F]] SO3_PHYSICBODY",
SO3BodyCreateCylinderExt },
8785 {
"SO3BodyCreatePyramidExt", 4,
"fun [SO3_OBJECT [F F F] [F F F] [F F F F]] SO3_PHYSICBODY",
SO3BodyCreatePyramidExt },
8787 {
"SO3BodyCreateShape", 2,
"fun [SO3_OBJECT F] SO3_PHYSICBODY",
SO3BodyCreateShape },
8789 {
"SO3BodyGetShapeDefinition", 1,
"fun [SO3_PHYSICBODY] [I F [F F] [F F F] [F F F] [F F F F]]",
SO3BodyGetShapeDefinition },
8790 {
"SO3BodySetMass", 2,
"fun [SO3_PHYSICBODY F] I",
SO3BodySetMass },
8793 {
"SO3BodySetForce", 2,
"fun [SO3_PHYSICBODY [F F F]] I",
SO3BodySetForce },
8794 {
"SO3BodyAddForce", 2,
"fun [SO3_PHYSICBODY [F F F]] I",
SO3BodyAddForce },
8795 {
"SO3BodyGetForce", 1,
"fun [SO3_PHYSICBODY] [F F F]",
SO3BodyGetForce },
8798 {
"SO3BodyAddTorque", 2,
"fun [SO3_PHYSICBODY [F F F]] I",
SO3BodyAddTorque },
8799 {
"SO3BodySetTorque", 2,
"fun [SO3_PHYSICBODY [F F F]] I",
SO3BodySetTorque },
8800 {
"SO3BodySetOmega", 2,
"fun [SO3_PHYSICBODY [F F F]] I",
SO3BodySetOmega },
8802 {
"SO3BodyAddImpulse", 3,
"fun [SO3_PHYSICBODY [F F F] [F F F]] I",
SO3BodyAddImpulse },
8803 {
"SO3BodyMoveTo", 3,
"fun [SO3_PHYSICBODY [F F F] F] I",
SO3BodyMoveTo },
8804 {
"SO3BodyRotateTo", 3,
"fun [SO3_PHYSICBODY [F F F F] F] I",
SO3BodyRotateTo },
8810 {
"SO3BodyGetOmega", 1,
"fun [SO3_PHYSICBODY] [F F F]",
SO3BodyGetOmega },
8811 {
"SO3BodyGetTorque", 1,
"fun [SO3_PHYSICBODY] [F F F]",
SO3BodyGetTorque },
8820 {
"SO3BodySetType", 2,
"fun [SO3_PHYSICBODY I] I",
SO3BodySetType },
8825 {
"SO3BodyGetInvMass", 1,
"fun [SO3_PHYSICBODY] [F [F F F]]",
SO3BodyGetInvMass },
8829 {
"SO3BodyGetType", 1,
"fun [SO3_PHYSICBODY] I",
SO3BodyGetType },
8843 {
"SO3BodySetFluid", 2,
"fun [SO3_PHYSICBODY I] I",
SO3BodySetFluid },
8847 {
"SO3BodyDestroy", 1,
"fun [SO3_PHYSICBODY] I",
SO3BodyDestroy },
8850 {
"SO3BodySetMaterial", 2,
"fun [SO3_PHYSICBODY SO3_PHYSICMATERIAL] I",
SO3BodySetMaterial },
8851 {
"SO3BodyGetMaterial", 1,
"fun [SO3_PHYSICBODY] SO3_PHYSICMATERIAL",
SO3BodyGetMaterial },
8860 {
"SO3CbMaterialCollision", 4,
"fun [SO3_PHYSICMATERIAL SO3_PHYSICMATERIAL fun [SO3_SCENE u0 SO3_PHYSICBODY SO3_PHYSICBODY [F F F] [F F F] [F F F] F] u1 u0 ] I",
SO3CbMaterialCollision },
8861 {
"SO3CbMaterialOverlapStarted", 4,
"fun [SO3_PHYSICMATERIAL SO3_PHYSICMATERIAL fun [SO3_SCENE u0 SO3_PHYSICBODY SO3_PHYSICBODY] u1 u0 ] I",
SO3CbMaterialOverlapStarted },
8862 {
"SO3CbMaterialOverlapEnded", 4,
"fun [SO3_PHYSICMATERIAL SO3_PHYSICMATERIAL fun [SO3_SCENE u0 SO3_PHYSICBODY SO3_PHYSICBODY] u1 u0 ] I",
SO3CbMaterialOverlapEnded },
8863 {
"SO3CbBodyLeaveWorld", 3,
"fun [SO3_PHYSICBODY fun [SO3_PHYSICBODY u0] u1 u0] SO3_PHYSICBODY",
SO3CbBodyLeaveWorld },
8866 {
"SO3PhysicsRayCast", 4,
"fun [SO3_SCENE [F F F] [F F F] F] [SO3_PHYSICBODY F [F F F]]",
SO3PhysicsRayCast },
8867 {
"SO3PhysicsRayCastExt", 4,
"fun [SO3_SCENE [F F F] [F F F] F] [[SO3_PHYSICBODY F [F F F]] r1]",
SO3PhysicsRayCastExt },
8883 {
"SO3PhysicsContraintCreateHinge", 6,
"fun [SO3_SCENE SO3_PHYSICBODY SO3_PHYSICBODY [F F F] [F F F] I] SO3_PHYSICCONTRAINT]",
SO3PhysicsContraintCreateHinge },
8893 {
"SO3PhysicsContraintCreateSlider", 7,
"fun [SO3_SCENE SO3_PHYSICBODY SO3_PHYSICBODY [F F F] [F F F] I I] SO3_PHYSICCONTRAINT]",
SO3PhysicsContraintCreateSlider },
NativeDefinition natSO3Phys[]
int SCOLfreePhysics()
free the SO3Engine Viewport function
int getMaterialOverlapEndedCallback(mmachine m, SCOL_PTR_TYPE id, SCOL_PTR_TYPE param)
C function that prepares the VM for the execution of the Physic Material Overlap callback.
int SO3_MATERIALPAIR_OVERLAP_STARTED_MSG
main include
int SCOLloadPhysics(mmachine m, cbmachine w)
Load the SO3Engine Viewport function.
SMaterialPair * getMaterialPairByWorld(SPhysicWorld *world, int ID1, int ID2)
function to check if a material ID exists
int getMaterialOverlapStartedCallback(mmachine m, SCOL_PTR_TYPE id, SCOL_PTR_TYPE param)
C function that prepares the VM for the execution of the Physic Material Overlap callback.
int SO3_MATERIALPAIR_COLLISION_MSG
int getMaterialContactCallback(mmachine m, SCOL_PTR_TYPE id, SCOL_PTR_TYPE param)
C function that prepares the VM for the execution of the callback a body leave the physic world.
bool MaterialIDExists(SScene *scene, string testName, SMaterialID **result)
function to check if a material ID exists
int SO3_MATERIALPAIR_OVERLAP_ENDED_MSG
float mod(float _a, float _b)
MMechostr(MSKDEBUG, " > Start loading Plugin SO3Engine dll\n")
SCOL_EXPORT int cbmachine w
SCOL_EXPORT void SCOL_PTR_TYPE param
int SO3PHYSICSMATERIALTYPE
int createBody(mmachine m, SNode *curNode)
int SO3PHYSICSMATERIALPAIR
int createPhysicContraint(mmachine m, SPhysicContraint *joint)
int createMaterialID(mmachine m, SMaterialID *curMatID, SScene *curScene)
int createMaterialPair(mmachine m, SMaterialPair *curMatPair, SScene *curScene)
Manage Physics Contraints. .
Manage Physics Contraints. .
SNode * GetNode(const std::string &nodeName) const
Manage Physics Contraint. .
Manage Box physics shape .
Manage Cone physics shape .
Manage Chamfer Cylinder physics shape .
Manage Concave Hull physics shape .
Manage Cone physics shape .
Manage Convex Hull physics shape .
Manage Cylinder physics shape .
Manage Pyramid physics shape .
Manage Physics Contraints. .
Manage Physics Contraints. .
int SO3BodySetType(mmachine m)
SO3BodySetType : Defines a user type of body.
int SO3PhysicsContraintGetVehicleTireAngularVelocity(mmachine m)
SO3PhysicsContraintGetVehicleTireAngularVelocity : Get a physic vehicle contraint tire angular veloci...
int SO3PhysicsContraintSetHingeMotorEnable(mmachine m)
SO3PhysicsContraintSetHingeMotorEnable : set a physic hinge contraint motor state.
int SO3BodyRotateTo(mmachine m)
SO3BodyRotateTo : Rotate a body to a orientation using forces.
int SO3PhysicsMaterialSetDefaultElasticity(mmachine m)
SO3PhysicsMaterialSetDefaultElasticity : defines Default elasticity between two physics material.
int SO3BodyGetTorque(mmachine m)
SO3BodyGetTorque : Get the torque of a body.
int SO3BodyGetIgnoreCollision(mmachine m)
SO3BodyGetIgnoreCollision : Retrieve the ignore collision state of a body.
int SO3PhysicsContraintSetSliderMotorEnable(mmachine m)
SO3PhysicsContraintSetSliderMotorEnable : set a physic slider contraint motor state.
int SO3PhysicsRayCast(mmachine m)
SO3PhysicsRayCast : send a raycast and return the distance.
int SO3BodyCalculateOffset(mmachine m)
SO3BodyCalculateOffset : calculate the mass offset of a body.
int SO3WorldSetPlateformArchitecture(mmachine m)
SO3WorldSetPlateformArchitecture : This function sets the platform architecture for the world !...
int SO3BodyGetForce(mmachine m)
SO3BodyGetForce : Get the current force of a body.
int SO3BodySetInitialState(mmachine m)
SO3BodySetInitialState : Set the current PRS as initial PRS to this body.
int SO3PhysicsContraintGetBallAndSocketOmega(mmachine m)
SO3PhysicsContraintGetBallAndSocketOmega : Get a physic ball and socket contraint omega.
int SO3PhysicsGetMaterial(mmachine m)
SO3PhysicsGetMaterial : return a material Physics by its name.
int SO3BodyCreateBasicJointUpVector(mmachine m)
SO3BodyCreateBasicJointUpVector : Create an up joint vector.
int SO3PhysicsContraintSetBallAndSocketLimits(mmachine m)
SO3PhysicsContraintSetBallAndSocketLimits : Set a physic ball and socket contraint cone limits.
int SO3BodySetFluid(mmachine m)
SO3BodySetFluid : defines a body as a fluid behavior.
int SO3BodySetVelocity(mmachine m)
SO3BodySetVelocity : Set a velocity to a body.
int SO3PhysicsContraintSetHingeMotorAngle(mmachine m)
SO3PhysicsContraintSetHingeMotorAngle : Set a physic hinge contraint to an angle.
int SO3PhysicsContraintSetSliderLimits(mmachine m)
SO3PhysicsContraintSetSliderLimits : Set a physic slider contraint distance limits.
int SO3BodyCreatePyramidExt(mmachine m)
SO3BodyCreatePyramidExt : Create a body as a pyramid shape.
int SO3PhysicsContraintAddVehicleTire(mmachine m)
SO3PhysicsContraintAddVehicleTire : Add a physic vehicle contraint tire.
int SO3BodySetMass(mmachine m)
SO3BodySetMass : Set a mass to a body.
int SO3BodyCreateConcaveShape(mmachine m)
SO3BodyCreateConcaveShape : Create a body as a shape (automatic calculation)
int SO3PhysicsContraintSetHingeLimits(mmachine m)
SO3PhysicsContraintSetHingeLimits : Set a physic hinge contraint angle limits.
int SO3WorldSetFPS(mmachine m)
SO3WorldSetFPS : defines FPS for physic world.
int SO3BodyCreateShape(mmachine m)
SO3BodyCreateShape : Create a body as a shape (automatic calculation)
int SO3PhysicsMaterialSetContiniousCollisionMode(mmachine m)
SO3PhysicsMaterialSetContiniousCollisionMode : do nothing deprecated.
int SO3BodySetIgnoreCollision(mmachine m)
SO3BodySetIgnoreCollision : Define if a body must be ignored when a collision occure.
int SO3BodyCreateBox(mmachine m)
SO3BodyCreateBox : Create a body as a box shape.
int SO3BodyAddGlobalForce(mmachine m)
SO3BodyAddGlobalForce : Add a global force to a body.
int SO3BodyGetFreeze(mmachine m)
SO3BodyGetFreeze : Get freeze state of a body.
int SO3BodyCreateCone(mmachine m)
SO3BodyCreateCone : Create a body as a cone shape.
int SO3BodyCreateBoxExt(mmachine m)
SO3BodyCreateBoxExt : Create a body as a box shape.
int SO3BodySetSimulation(mmachine m)
SO3BodySetSimulation : Enable or disable a body simulation.
int SO3WorldSetEnabled(mmachine m)
SO3WorldSetEnabled : Activate or Deactivate the physic world.
int SO3PhysicsContraintGetVehicleTireOnAir(mmachine m)
SO3PhysicsContraintGetVehicleTireOnAir : Get a physic vehicle contraint tire on air state.
int SO3BodyGetConstantTorque(mmachine m)
SO3BodyGetConstantTorque : Get the current constant torque of a body.
int SO3PhysicsContraintGetSliderForce(mmachine m)
SO3PhysicsContraintGetSliderForce : Get a physic slider contraint force.
int SO3BodyGetShapeDefinition(mmachine m)
SO3BodyGetShapeDefinition : Get a body shape definition.
int SO3BodyCreateEllipsoid(mmachine m)
SO3BodyCreateEllipsoid : Create a body as an ellipsoid shape.
int SO3PhysicsMaterialSetDefaultSoftness(mmachine m)
SO3PhysicsMaterialSetDefaultSoftness : defines Default softness between two physics material.
int SO3PhysicsContraintCreateSlider(mmachine m)
SO3PhysicsContraintCreateSlider : Create a slider contraint.
int SO3PhysicsContraintSetVehicleDrivingTorque(mmachine m)
SO3PhysicsContraintSetVehicleDrivingTorque : Set a physic vehicle contraint driving torque.
int SO3WorldApplyImpulsePoint(mmachine m)
SO3WorldApplyImpulsePoint : Apply an impulsion on bodies in the point area.
int SO3BodyCreateCylinder(mmachine m)
SO3BodyCreateCylinder : Create a body as a cylinder shape.
int SO3BodySetOmega(mmachine m)
SO3BodySetOmega : Set an omega to a body.
int SO3PhysicsContraintGetVehicleSpeed(mmachine m)
SO3PhysicsContraintGetVehicleSpeed : Get a physic vehicle contraint speed.
int SO3PhysicsContraintSetBallAndSocketAngularVelocity(mmachine m)
SO3PhysicsContraintSetBallAndSocketAngularVelocity : Set a physic ball and socket contraint angular v...
int SO3BodyGetLinearDamping(mmachine m)
SO3BodyGetLinearDamping : Get the linear damping of a body.
int SO3BodySetFreeze(mmachine m)
SO3BodySetFreeze : Set a body to freeze state.
int SO3PhysicsContraintSetBallAndSocketYawAngle(mmachine m)
SO3PhysicsContraintSetBallAndSocketYawAngle : Set a physic ball and socket contraint Yaw angle The co...
int SO3BodyAddLocalForce(mmachine m)
SO3BodyAddLocalForce : Add a local force to a body.
int SO3BodyGetSimulation(mmachine m)
SO3BodyGetSimulation : Get simulation state of a body.
int SO3BodyCreateCylinderExt(mmachine m)
SO3BodyCreateCylinderExt : Create a body as a cylinder shape.
int SO3BodyGetFluid(mmachine m)
SO3BodyGetFluid : Retrieve the fluid state of a body.
int SO3WorldGetGravity(mmachine m)
SO3WorldGetGravity : get the gravity of the scene.
int SO3PhysicsContraintCreateBallAndSocket(mmachine m)
SO3PhysicsContraintCreateBallAndSocket : Create a physic ball and socket contraint.
int SO3BodyGetContiniousCollisionMode(mmachine m)
SO3BodyGetContiniousCollisionMode : Get the continuous collision mode of a body.
int SO3BodyAddTorque(mmachine m)
SO3BodyAddTorque : Add torque vector to a body.
int SO3PhysicsContraintSetHingeTorque(mmachine m)
SO3PhysicsContraintSetHingeTorque : Set a physic hinge contraint torque.
int SO3WorldReset(mmachine m)
SO3WorldReset : Reset the physic world and all bodies states.
int SO3WorldShowLines(mmachine m)
SO3WorldShowLines : Return true if world shows its debug calculation lines.
int SO3BodyGetOmega(mmachine m)
SO3BodyGetOmega : Get the omega of a body.
int SO3BodySetFluidVolumeRatio(mmachine m)
SO3BodySetFluidVolumeRatio : Set a body fluid parameters.
int SO3PhysicsContraintSetSliderMotorVelocity(mmachine m)
SO3PhysicsContraintSetSliderMotorVelocity : Set a physic slider contraint velocity.
int SO3BodySetAngularDamping(mmachine m)
SO3BodySetAngularDamping : defines angular Damping of a body.
int SO3PhysicsContraintGetHingeForce(mmachine m)
SO3PhysicsContraintGetHingeForce : Get a physic hinge contraint force.
int SO3PhysicsContraintSetBallAndSocketControlled(mmachine m)
SO3PhysicsContraintSetBallAndSocketControlled : Set a physic ball and socket contraint controlled mod...
int SO3BodyAddConstantTorque(mmachine m)
SO3BodyAddConstantTorque : Add a torque force to a body that will be constant each frame.
int SO3BodyGetAngularDamping(mmachine m)
SO3BodyGetAngularDamping : Get the angular damping of a body.
int SO3BodyGetVelocity(mmachine m)
SO3BodyGetVelocity : Get the velocity of a body.
int SO3BodySetMaterial(mmachine m)
SO3BodySetMaterial : Set a material for a body.
int SO3PhysicsContraintCreateHinge(mmachine m)
SO3PhysicsContraintCreateHinge : Create a hinge contraint.
int SO3BodySetLinearDamping(mmachine m)
SO3BodySetLinearDamping : defines linear damping of a body.
int SO3PhysicsContraintGetBallAndSocketForce(mmachine m)
SO3PhysicsContraintGetBallAndSocketForce : Get a physic ball and socket contraint force.
int SO3BodyGetFluidVolumeRatio(mmachine m)
SO3BodyGetFluidVolumeRatio : get the fluid parameters of a body.
int SO3BodyDestroy(mmachine m)
SO3BodyDestroy : Destroy a body.
int SO3BodyCreateChamferCylinderExt(mmachine m)
SO3BodyCreateChamferCylinderExt : Create a body as a chamfer cylinder shape.
int SO3BodySetAutoSleep(mmachine m)
SO3BodySetAutoSleep : defines Auto sleep state of a body.
int SO3PhysicsMaterialSetDefaultCollidable(mmachine m)
SO3PhysicsMaterialSetDefaultCollidable : defines Default Collidable state between two physics materia...
int SO3BodyGetPositionOrientation(mmachine m)
SO3BodyGetPositionOrientation : Get the position/orientation of a body.
int SO3BodyAddForce(mmachine m)
SO3BodyAddForce : Add a force to a body.
int SO3BodyGetGravityEnable(mmachine m)
SO3BodyGetGravityEnable : Get freeze state of a body.
int SO3BodyMoveTo(mmachine m)
SO3BodyMoveTo : Move a body to a position using forces.
int SO3PhysicsContraintSetBallAndSocketRollAngle(mmachine m)
SO3PhysicsContraintSetBallAndSocketRollAngle : Set a physic ball and socket contraint Roll angle The ...
int SO3PhysicsContraintGetCollisionState(mmachine m)
SO3PhysicsContraintGetCollisionState : Get a physic contraint collision state between the son and the...
int SO3BodyShowDebug(mmachine m)
SO3BodyShowDebug : Set the body shape visible state.
int SO3WorldSetFrictionModel(mmachine m)
SO3WorldSetFrictionModel : This function sets the friction model for the world ! Deprecated !
int SO3WorldGetSolverModel(mmachine m)
SO3WorldGetSolverModel : This function gets the solver model of the world.
int SO3BodyGetCenterOfMass(mmachine m)
SO3BodyGetCenterOfMass : Get the center of masse of a body.
int SO3BodyAddConstantForce(mmachine m)
SO3BodyAddConstantForce : Add a force to a body that will be constant each frame.
int SO3PhysicsMaterialSetSurfaceThickness(mmachine m)
SO3PhysicsMaterialSetSurfaceThickness : defines Surface thickness between two physics material.
int SO3PhysicsRayCastExt(mmachine m)
SO3PhysicsRayCastExt : send a raycast all the hit bodies.
int SO3PhysicsContraintDestroy(mmachine m)
SO3PhysicsContraintDestroy : Destroy a physic contraint.
int SO3PhysicsMaterialCreate(mmachine m)
SO3PhysicsMaterialCreate : Create a new Physic Material ID.
int SO3WorldGetPlateformArchitecture(mmachine m)
SO3WorldGetPlateformArchitecture : This function gets the platform architecture for the world !...
int SO3PhysicsContraintGetVehicleOnAir(mmachine m)
SO3PhysicsContraintGetVehicleOnAir : Get if a physic vehicle contraint has tires on the ground.
int SO3BodyGetType(mmachine m)
SO3BodyGetType : Returns the user type of body.
int SO3WorldGetFPS(mmachine m)
SO3WorldGetFPS : retrieve the FPS for physic world.
int SO3WorldGetFrictionModel(mmachine m)
SO3WorldGetFrictionModel : This function gets the friction model for the world ! Deprecated !
int SO3PhysicsMaterialDestroy(mmachine m)
SO3PhysicsMaterialDestroy : Destroy a Physic Material ID.
int SO3BodySetCenterOfMass(mmachine m)
SO3BodySetCenterOfMass : defines center of mass for a body.
int SO3BodyGetMaterial(mmachine m)
SO3BodyGetMaterial : Get a material of a body.
int SO3PhysicsContraintCreateVehicle(mmachine m)
SO3PhysicsContraintCreateVehicle : Create a vehicle contraint.
int SO3BodyCreateCapsuleExt(mmachine m)
SO3BodyCreateCapsuleExt : Create a body as a capsule shape.
int SO3BodyGetMassMatrix(mmachine m)
SO3BodyGetMassMatrix : Get the mass matrix of a body.
int SO3PhysicsContraintGetHingeOmega(mmachine m)
SO3PhysicsContraintGetHingeOmega : Get a physic hinge contraint omega.
int SO3PhysicsContraintSetVehicleSteerAngle(mmachine m)
SO3PhysicsContraintSetVehicleSteerAngle : Set a physic vehicle contraint steer angle.
int SO3WorldSetBodiesInitialState(mmachine m)
SO3WorldSetBodiesInitialState : Set the current PRS as initial PRS to all bodies.
int SO3PhysicsContraintSetHingeMotorOmega(mmachine m)
SO3PhysicsContraintSetHingeMotorOmega : Set a physic hinge contraint omega.
int SO3WorldSetSize(mmachine m)
SO3WorldSetSize : function to defines world size.
int SO3BodySetTorque(mmachine m)
SO3BodySetTorque : Set a torque to a body.
int SO3BodySetContiniousCollisionMode(mmachine m)
SO3BodySetContiniousCollisionMode : defines continuous collision mode of a body.
int SO3BodyCreateEllipsoidExt(mmachine m)
SO3BodyCreateEllipsoidExt : Create a body as an ellipsoid shape.
int SO3WorldGetEnabled(mmachine m)
SO3WorldGetEnabled : Return the enable state of the physic world.
int SO3BodySetPositionOrientation(mmachine m)
SO3BodySetPositionOrientation : Set Position/Orientation of a body DO NOT USE.
int SO3PhysicsContraintSetHingeBrake(mmachine m)
SO3PhysicsContraintSetHingeBrake : Set a physic hinge contraint brake.
int SO3PhysicsGetMaterialName(mmachine m)
SO3PhysicsGetMaterialName : return the name of a Physics material.
int SO3PhysicsContraintGetStiffness(mmachine m)
SO3PhysicsContraintGetStiffness : Get a physic contraint stiffness value.
int SO3BodySetConstantTorque(mmachine m)
SO3BodySetConstantTorque : Set a constant torque force to a body that will be constant each frame.
int SO3BodySetGravityEnable(mmachine m)
SO3BodySetGravityEnable : Set a body to freeze state.
int SO3PhysicsContraintGetSliderVelocity(mmachine m)
SO3PhysicsContraintGetSliderVelocity : Get a physic hinge contraint velocity.
int SO3PhysicsContraintSetBallAndSocketPitchAngle(mmachine m)
SO3PhysicsContraintSetBallAndSocketPitchAngle : Set a physic ball and socket contraint Pitch angle Th...
int SO3PhysicsContraintSetSliderFriction(mmachine m)
SO3PhysicsContraintSetSliderFriction : Set a physic slider contraint friction.
int SO3SceneNodeGetBody(mmachine m)
SO3SceneNodeGetBody : Get the body attached to a node.
int SO3BodyGetConstantForce(mmachine m)
SO3BodyGetConstantForce : Get the current constant force of a body.
int SO3BodyDestroyBasicJointUpVector(mmachine m)
SO3BodyDestroyBasicJointUpVector : Destroying an up joint vector.
int SO3BodySetMassMatrix(mmachine m)
SO3BodySetMassMatrix : defines mass matrix of a body.
int SO3BodyGetSleepingState(mmachine m)
SO3BodyGetSleepingState : Get the sleep state of a body.
int SO3PhysicsContraintSetCollisionState(mmachine m)
SO3PhysicsContraintSetCollisionState : Set a physic contraint collision state between the son and the...
int SO3BodyGetAutoSleep(mmachine m)
SO3BodyGetAutoSleep : Get the auto sleep state of a body.
int SO3BodyCreateChamferCylinder(mmachine m)
SO3BodyCreateChamferCylinder : Create a body as a chamfer cylinder shape.
int SO3PhysicsContraintGetSliderPosition(mmachine m)
SO3PhysicsContraintGetSliderPosition : Get a physic slider contraint position.
int SO3PhysicsContraintSetSliderSpring(mmachine m)
SO3PhysicsContraintSetSliderSpring : Set a physic slider contraint spring setting.
int SO3BodyCreateCollisionTree(mmachine m)
SO3BodyCreateCollisionTree : Create a body as an exact collision tree.
int SO3BodySetForce(mmachine m)
SO3BodySetForce : Set a force to a body.
int SO3PhysicsMaterialSetDefaultFriction(mmachine m)
SO3PhysicsMaterialSetDefaultFriction : defines Default friction between two physics material.
int SO3BodyGetInvMass(mmachine m)
SO3BodyGetInvMass : Get the inverse mass matrix of a body.
int SO3WorldSetSolverModel(mmachine m)
SO3WorldSetSolverModel : This function sets thesolver model for the world.
int SO3BodySetConstantForce(mmachine m)
SO3BodySetConstantForce : Set a force to a body that will be constant each frame.
int SO3PhysicsContraintGetBallAndSocketAngle(mmachine m)
SO3PhysicsContraintGetBallAndSocketAngle : Get a physic ball and socket contraint angle.
int SO3BodyCreateCapsule(mmachine m)
SO3BodyCreateCapsule : Create a body as a capsule shape.
int SO3BodyCreateConeExt(mmachine m)
SO3BodyCreateConeExt : Create a body as a cone shape.
int SO3PhysicsContraintSetVehicleBrake(mmachine m)
SO3PhysicsContraintSetVehicleBrake : Set a physic vehicle contraint brake.
int SO3PhysicsContraintSetStiffness(mmachine m)
SO3PhysicsContraintSetStiffness : Set a physic contraint stiffness value.
int SO3BodyGetSceneNode(mmachine m)
SO3BodyGetSceneNode : Get the scene Node asssociated to a body.
int SO3WorldSetGravity(mmachine m)
SO3WorldSetGravity : defines gravity for the scene.
int SO3PhysicsContraintGetHingeAngle(mmachine m)
SO3PhysicsContraintGetHingeAngle : Get a physic hinge contraint angle.
int SO3BodyAddImpulse(mmachine m)
SO3BodyAddImpulse : Add an impulsion to a body.
int SO3BodyCreatePyramid(mmachine m)
SO3BodyCreatePyramid : Create a body as a pyramid shape.
int SO3CbMaterialOverlapStarted(mmachine m)
SO3CbMaterialOverlapStarted : Define the callback scol had to be called when two material ID start to...
int SO3CbBodyLeaveWorld(mmachine m)
SO3CbBodyLeaveWorld : Define the scol callback had to be called when a body leave the physic world de...
int SO3CbMaterialCollision(mmachine m)
SO3CbMaterialCollision : Define the callback scol had to be called when two material ID collide.
int SO3CbMaterialOverlapEnded(mmachine m)
SO3CbMaterialOverlapEnded : Define the callback scol had to be called when two material ID does not o...