Fixes
This commit is contained in:
@@ -222,6 +222,7 @@ void Entity::RegisterBaseFunctions()
|
||||
m_luaObject.Register("has_rigid_body", *this, &Entity::Lua_HasRigidBody);
|
||||
m_luaObject.Register("create_box_body", *this, &Entity::Lua_CreateBoxBody);
|
||||
m_luaObject.Register("create_sphere_body", *this, &Entity::Lua_CreateSphereBody);
|
||||
m_luaObject.Register("ForceBodyTransformUpdate", *this, &Entity::Lua_ForceBodyTransformUpdate);
|
||||
|
||||
// animation
|
||||
m_luaObject.Register("find_animation", *this, &Entity::Lua_FindAnimation);
|
||||
@@ -487,6 +488,13 @@ int Entity::Lua_CreateSphereBody(LuaPlus::LuaState* state)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Entity::Lua_ForceBodyTransformUpdate(LuaPlus::LuaState* state)
|
||||
{
|
||||
ForceUpdateBodyTranslation();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Entity::Lua_FindAnimation(LuaPlus::LuaState* state)
|
||||
{
|
||||
LuaPlus::LuaStack stack(state);
|
||||
@@ -692,6 +700,18 @@ void Entity::UpdateBodyDirty()
|
||||
}
|
||||
}
|
||||
|
||||
void Entity::ForceUpdateBodyTranslation()
|
||||
{
|
||||
if (!m_rigidBody)
|
||||
return;
|
||||
|
||||
// I'm sure that position is valid
|
||||
btTransform xform;
|
||||
xform.setIdentity();
|
||||
xform.setOrigin(glmVectorToBt(m_position));
|
||||
m_rigidBody->setWorldTransform(xform);
|
||||
}
|
||||
|
||||
REGISTER_ENTITY(WeaponBase);
|
||||
|
||||
WeaponBase::WeaponBase()
|
||||
|
||||
@@ -91,6 +91,7 @@ public:
|
||||
|
||||
void UpdateBody();
|
||||
void UpdateBodyDirty();
|
||||
void ForceUpdateBodyTranslation();
|
||||
|
||||
// Game entity lua bindings
|
||||
|
||||
@@ -125,6 +126,7 @@ public:
|
||||
int Lua_HasRigidBody(LuaPlus::LuaState* state);
|
||||
int Lua_CreateBoxBody(LuaPlus::LuaState* state);
|
||||
int Lua_CreateSphereBody(LuaPlus::LuaState* state);
|
||||
int Lua_ForceBodyTransformUpdate(LuaPlus::LuaState* state);
|
||||
|
||||
int Lua_FindAnimation(LuaPlus::LuaState* state);
|
||||
int Lua_PlayAnimation(LuaPlus::LuaState* state);
|
||||
|
||||
Reference in New Issue
Block a user