Skip to content

Commit

Permalink
Body3D Lua bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardodoria committed Nov 28, 2023
1 parent 98b8f6c commit d40d69d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion engine/core/object/physics/Body3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace Supernova{
void createMeshShape(std::vector<Vector3> vertices, std::vector<uint16_t> indices);
void createHeightFieldShape();
void createHeightFieldShape(unsigned int samplesSize);
//TODO:
//TODO: missing compound shapes
// StaticCompoundShape
// MutableCompoundShape

Expand Down
25 changes: 25 additions & 0 deletions engine/core/script/binding/ObjectClassesLua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,31 @@ void LuaBinding::registerObjectClasses(lua_State *L){
luabridge::overload<>(&Body3D::createHeightFieldShape),
luabridge::overload<unsigned int>(&Body3D::createHeightFieldShape))
.addProperty("type", &Body3D::getType, &Body3D::setType)
.addFunction("canBeKinematicOrDynamic", &Body3D::canBeKinematicOrDynamic)
.addProperty("sensor", &Body3D::isSensor, &Body3D::setIsSensor)
.addProperty("collisionGroupID", &Body3D::getCollisionGroupID, &Body3D::setCollisionGroupID)
.addProperty("sllowSleeping", &Body3D::isAllowSleeping, &Body3D::setAllowSleeping)
.addProperty("friction", &Body3D::getFriction, &Body3D::setFriction)
.addProperty("restitution", &Body3D::getRestitution, &Body3D::setRestitution)
.addProperty("linearVelocity", &Body3D::getLinearVelocity, &Body3D::setLinearVelocity)
.addFunction("setLinearVelocityClamped", &Body3D::setLinearVelocityClamped)
.addProperty("angularVelocity", &Body3D::getAngularVelocity, &Body3D::setAngularVelocity)
.addFunction("setAngularVelocityClamped", &Body3D::setAngularVelocityClamped)
.addFunction("getPointVelocityCOM", &Body3D::getPointVelocityCOM)
.addFunction("getPointVelocity", &Body3D::getPointVelocity)
.addFunction("getAccumulatedForce", &Body3D::getAccumulatedForce)
.addFunction("getAccumulatedTorque", &Body3D::getAccumulatedTorque)
.addFunction("getInverseInertia", &Body3D::getInverseInertia)
.addFunction("applyForce",
luabridge::overload<const Vector3&>(&Body3D::applyForce),
luabridge::overload<const Vector3&, const Vector3&>(&Body3D::applyForce))
.addFunction("applyTorque", &Body3D::applyTorque)
.addFunction("applyImpulse",
luabridge::overload<const Vector3&>(&Body3D::applyImpulse),
luabridge::overload<const Vector3&, const Vector3&>(&Body3D::applyImpulse))
.addFunction("applyAngularImpulse", &Body3D::applyAngularImpulse)
.addFunction("applyBuoyancyImpulse", &Body3D::applyBuoyancyImpulse)
.addFunction("getCenterOfMassPosition", &Body3D::getCenterOfMassPosition)
.endClass();

#endif //DISABLE_LUA_BINDINGS
Expand Down

0 comments on commit d40d69d

Please sign in to comment.