fixed error message when physical box dimension is set to 0

fixed crash when an entity with script component without valid path to script collides
This commit is contained in:
Mikulas Florek 2015-12-02 21:29:36 +01:00
parent 60cb32b833
commit adbff40a45
2 changed files with 5 additions and 3 deletions

View file

@ -149,6 +149,8 @@ public:
{
ASSERT(m_global_state);
auto& script = *cmp;
if (!script.m_state) return;
lua_rawgeti(script.m_state, LUA_REGISTRYINDEX, script.m_environment);
if (lua_getfield(script.m_state, -1, "onContact") != LUA_TFUNCTION)
{

View file

@ -841,9 +841,9 @@ struct PhysicsSceneImpl : public PhysicsScene
bool is_box = shapes->getBoxGeometry(box);
ASSERT(is_box);
physx::PxVec3& half = box.halfExtents;
half.x = size.x;
half.y = size.y;
half.z = size.z;
half.x = Math::maxValue(0.01f, size.x);
half.y = Math::maxValue(0.01f, size.y);
half.z = Math::maxValue(0.01f, size.z);
shapes->setGeometry(box);
}
}