Fixed transform updates to clear dirty flags appropriately #280
|
@ -107,6 +107,7 @@ namespace SHADE
|
||||||
const SHVec3& RELATIVE_EXTENTS = box->GetRelativeExtents();
|
const SHVec3& RELATIVE_EXTENTS = box->GetRelativeExtents();
|
||||||
|
|
||||||
// Recompute world extents based on new scale and fixed relative extents
|
// Recompute world extents based on new scale and fixed relative extents
|
||||||
|
|
||||||
const SHVec3 WORLD_EXTENTS = RELATIVE_EXTENTS * (scale * 0.5f);
|
const SHVec3 WORLD_EXTENTS = RELATIVE_EXTENTS * (scale * 0.5f);
|
||||||
box->SetWorldExtents(WORLD_EXTENTS);
|
box->SetWorldExtents(WORLD_EXTENTS);
|
||||||
|
|
||||||
|
@ -118,6 +119,7 @@ namespace SHADE
|
||||||
const float RELATIVE_RADIUS = sphere->GetRelativeRadius();
|
const float RELATIVE_RADIUS = sphere->GetRelativeRadius();
|
||||||
|
|
||||||
// Recompute world radius based on new scale and fixed radius
|
// Recompute world radius based on new scale and fixed radius
|
||||||
|
|
||||||
const float MAX_SCALE = SHMath::Max({ scale.x, scale.y, scale.z });
|
const float MAX_SCALE = SHMath::Max({ scale.x, scale.y, scale.z });
|
||||||
const float WORLD_RADIUS = RELATIVE_RADIUS * MAX_SCALE * 0.5f;
|
const float WORLD_RADIUS = RELATIVE_RADIUS * MAX_SCALE * 0.5f;
|
||||||
sphere->SetWorldRadius(WORLD_RADIUS);
|
sphere->SetWorldRadius(WORLD_RADIUS);
|
||||||
|
|
|
@ -206,7 +206,7 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the half extents relative to world scale
|
// Set the half extents relative to world scale
|
||||||
const SHVec3 WORLD_EXTENTS = correctedHalfExtents * COLLIDER->GetScale();
|
const SHVec3 WORLD_EXTENTS = correctedHalfExtents * COLLIDER->GetScale() * 0.5f;
|
||||||
|
|
||||||
if (type != Type::BOX)
|
if (type != Type::BOX)
|
||||||
{
|
{
|
||||||
|
|
|
@ -309,12 +309,9 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
colliderComponent->position = WORLD_POS;
|
colliderComponent->position = WORLD_POS;
|
||||||
colliderComponent->orientation = WORLD_ROT;
|
colliderComponent->orientation = WORLD_ROT;
|
||||||
|
colliderComponent->scale = WORLD_SCL;
|
||||||
|
|
||||||
if (colliderComponent->scale != WORLD_SCL)
|
colliderComponent->RecomputeCollisionShapes();
|
||||||
{
|
|
||||||
colliderComponent->scale = WORLD_SCL;
|
|
||||||
colliderComponent->RecomputeCollisionShapes();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue