Skip to content

Commit

Permalink
Added Clamp and fixed crash
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunkTreasure1 committed Dec 12, 2023
1 parent f829908 commit a832cbb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Engine/Volt-ScriptCore/Source/Volt/Math/Mathf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ public static float Clamp(float value, float min, float max)
return value > max ? max : value;
}

public static Vector3 Clamp(Vector3 value, Vector3 min, Vector3 max)
{
return new Vector3(Clamp(value.x, min.x, max.x), Clamp(value.y, min.y, max.y), Clamp(value.z, min.z, max.z));
}

public static float Asin(float x) => (float)Math.Asin(x);
public static float Atan(float x) => (float)Math.Atan(x);
public static float Atan2(float y, float x) => (float)Math.Atan2(y, x);
Expand Down
4 changes: 4 additions & 0 deletions Volt/Sandbox/src/Sandbox/DebugRendering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ void Sandbox::RenderSelection(Ref<Volt::Camera> camera)
for (const auto& id : SelectionManager::GetSelectedEntities())
{
Volt::Entity entity = myRuntimeScene->GetEntityFromUUID(id);
if (!entity)
{
continue;
}

if (!entity.HasComponent<Volt::TransformComponent>())
{
Expand Down

0 comments on commit a832cbb

Please sign in to comment.