diff --git a/src/Entity.c b/src/Entity.c index 710b6f1ab..b73e89b26 100644 --- a/src/Entity.c +++ b/src/Entity.c @@ -110,8 +110,10 @@ static void Entity_ParseScale(struct Entity* e, const String* scale) { float value, maxScale; if (!Convert_ParseFloat(scale, &value)) return; - maxScale = e->Model->MaxScale; - Math_Clamp(value, 0.01f, maxScale); + value = max(value, 0.001f); + /* local player doesn't allow giant model scales */ + /* (can't climb stairs, extremely CPU intensive collisions) */ + if (e->ModelRestrictedScale) { value = min(value, e->Model->MaxScale); } e->ModelScale = Vector3_Create1(value); } @@ -904,6 +906,7 @@ static void LocalPlayer_Init(void) { PhysicsComp_Init(&p->Physics, &p->Base); TiltComp_Init(&p->Tilt); + p->Base.ModelRestrictedScale = true; p->ReachDistance = 5.0f; p->Physics.Hacks = &p->Hacks; p->Physics.Collisions = &p->Collisions; diff --git a/src/Entity.h b/src/Entity.h index e2324c194..0c342f20c 100644 --- a/src/Entity.h +++ b/src/Entity.h @@ -74,6 +74,7 @@ struct Entity { struct Model* Model; BlockID ModelBlock; /* BlockID, if model name was originally a valid block. */ + bool ModelRestrictedScale; /* true to restrict model scale (needed for local player, otherwise collisions are too costly) */ struct AABB ModelAABB; Vector3 ModelScale, Size; float StepSize;