mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 12:05:14 -04:00
allow models for other entities to be any scale
your own scale is still restricted to 2-3, because collisions are extremely costly at large model scales
This commit is contained in:
parent
0c5674637a
commit
015af253ab
@ -110,8 +110,10 @@ static void Entity_ParseScale(struct Entity* e, const String* scale) {
|
|||||||
float value, maxScale;
|
float value, maxScale;
|
||||||
if (!Convert_ParseFloat(scale, &value)) return;
|
if (!Convert_ParseFloat(scale, &value)) return;
|
||||||
|
|
||||||
maxScale = e->Model->MaxScale;
|
value = max(value, 0.001f);
|
||||||
Math_Clamp(value, 0.01f, maxScale);
|
/* 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);
|
e->ModelScale = Vector3_Create1(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -904,6 +906,7 @@ static void LocalPlayer_Init(void) {
|
|||||||
PhysicsComp_Init(&p->Physics, &p->Base);
|
PhysicsComp_Init(&p->Physics, &p->Base);
|
||||||
TiltComp_Init(&p->Tilt);
|
TiltComp_Init(&p->Tilt);
|
||||||
|
|
||||||
|
p->Base.ModelRestrictedScale = true;
|
||||||
p->ReachDistance = 5.0f;
|
p->ReachDistance = 5.0f;
|
||||||
p->Physics.Hacks = &p->Hacks;
|
p->Physics.Hacks = &p->Hacks;
|
||||||
p->Physics.Collisions = &p->Collisions;
|
p->Physics.Collisions = &p->Collisions;
|
||||||
|
@ -74,6 +74,7 @@ struct Entity {
|
|||||||
|
|
||||||
struct Model* Model;
|
struct Model* Model;
|
||||||
BlockID ModelBlock; /* BlockID, if model name was originally a valid block. */
|
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;
|
struct AABB ModelAABB;
|
||||||
Vector3 ModelScale, Size;
|
Vector3 ModelScale, Size;
|
||||||
float StepSize;
|
float StepSize;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user