Avoid sqrt of length()

This commit is contained in:
Benau 2019-03-25 21:13:48 +08:00
parent 8a00d1e1ab
commit 4670c9a5e9

View File

@ -155,7 +155,7 @@ void Flyable::createPhysics(float forw_offset, const Vec3 &velocity,
Physics::getInstance()->addBody(getBody());
m_body->setGravity(gravity);
if (gravity.length() != 0.0f && m_do_terrain_info)
if (gravity.length2() != 0.0f && m_do_terrain_info)
{
m_compressed_gravity_vector = MiniGLM::compressVector3(
Vec3(m_body->getGravity().normalized()).toIrrVector());