Scene changes and Bug fixes #336
|
@ -12,7 +12,6 @@ public class Breakable : Script
|
||||||
private Transform trans;
|
private Transform trans;
|
||||||
public bool isBreak { get; set; }
|
public bool isBreak { get; set; }
|
||||||
private List<GameObject> itemPieces = new List<GameObject>();
|
private List<GameObject> itemPieces = new List<GameObject>();
|
||||||
public bool print = false;
|
|
||||||
|
|
||||||
protected override void awake()
|
protected override void awake()
|
||||||
{
|
{
|
||||||
|
@ -44,9 +43,6 @@ public class Breakable : Script
|
||||||
if (ignoreRaccoon && info.GameObject.GetScript<PlayerController>())
|
if (ignoreRaccoon && info.GameObject.GetScript<PlayerController>())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(print)
|
|
||||||
Debug.Log($"COLLIED {rb.LinearVelocity.GetSqrMagnitude()} with EiD: {info.GameObject.Name}");
|
|
||||||
|
|
||||||
if (rb.LinearVelocity.GetSqrMagnitude() > threshHold && !info.GameObject.GetScript<PlayerController>())
|
if (rb.LinearVelocity.GetSqrMagnitude() > threshHold && !info.GameObject.GetScript<PlayerController>())
|
||||||
{
|
{
|
||||||
isBreak = true;
|
isBreak = true;
|
||||||
|
|
|
@ -200,25 +200,36 @@ public class PickAndThrow : Script
|
||||||
{
|
{
|
||||||
if (pc != null)
|
if (pc != null)
|
||||||
{
|
{
|
||||||
Vector3 dirNor = pc.tranform.Forward;
|
Vector3 dirNor = pc.tranform.Forward;
|
||||||
Vector3 playerRayPos = pc.tranform.GlobalPosition;
|
Vector3 playerRayPos = pc.tranform.GlobalPosition;
|
||||||
playerRayPos.y += 0.05f;
|
playerRayPos.y += 0.05f;
|
||||||
dirNor.Normalise();
|
dirNor.Normalise();
|
||||||
List<RaycastHit> rayList1 = Physics.Raycast(new Ray(playerRayPos, Vector3.RotateY(dirNor, SHADE.Math.DegreesToRadians(22.5f))), rayDistance, false, (ushort)65535);
|
List<RaycastHit> rayList1 = Physics.Raycast(new Ray(playerRayPos, Vector3.RotateY(dirNor, SHADE.Math.DegreesToRadians(22.5f))), rayDistance, false, (ushort)65535);
|
||||||
List<RaycastHit> rayList2 = Physics.Raycast(new Ray(playerRayPos, Vector3.RotateY(dirNor, SHADE.Math.DegreesToRadians(-22.5f))), rayDistance, false, (ushort)65535);
|
List<RaycastHit> rayList2 = Physics.Raycast(new Ray(playerRayPos, Vector3.RotateY(dirNor, SHADE.Math.DegreesToRadians(-22.5f))), rayDistance, false, (ushort)65535);
|
||||||
List<RaycastHit> rayList3 = Physics.Raycast(new Ray(playerRayPos, dirNor), rayDistance * 0.75f, false, (ushort)65535);
|
List<RaycastHit> rayList3 = Physics.Raycast(new Ray(playerRayPos, dirNor), rayDistance * 0.75f, false, (ushort)65535);
|
||||||
|
|
||||||
if (rayList1.Count > 0 && rayList2.Count > 0 && rayList3.Count > 0)
|
if (rayList1.Count > 0)
|
||||||
{
|
{
|
||||||
RaycastHit ray1 = rayList1[0];
|
RaycastHit ray1 = rayList1[0];
|
||||||
RaycastHit ray2 = rayList2[0];
|
inRange = CheckForItem(ray1);
|
||||||
RaycastHit ray3 = rayList3[0];
|
return;
|
||||||
inRange = CheckForItem(ray1) || CheckForItem(ray2) || CheckForItem(ray3);
|
}
|
||||||
}
|
else if (rayList2.Count > 0)
|
||||||
else
|
{
|
||||||
{
|
RaycastHit ray2 = rayList2[0];
|
||||||
inRange = false;
|
inRange = CheckForItem(ray2);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
else if (rayList3.Count > 0)
|
||||||
|
{
|
||||||
|
RaycastHit ray3 = rayList3[0];
|
||||||
|
inRange = CheckForItem(ray3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inRange = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
if (Begin())
|
if (Begin())
|
||||||
{
|
{
|
||||||
|
DrawMenuBar();
|
||||||
ImGui::BeginTable("CollisionMtxTable", SHCollisionTag::NUM_LAYERS + 1, ImGuiTableRowFlags_Headers);
|
ImGui::BeginTable("CollisionMtxTable", SHCollisionTag::NUM_LAYERS + 1, ImGuiTableRowFlags_Headers);
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::PushID("CollisionTagNames");
|
ImGui::PushID("CollisionTagNames");
|
||||||
|
@ -56,7 +57,10 @@ namespace SHADE
|
||||||
if(i == idx)
|
if(i == idx)
|
||||||
continue;
|
continue;
|
||||||
std::string label = std::format("##{} vs {}", tagName, tagName2);
|
std::string label = std::format("##{} vs {}", tagName, tagName2);
|
||||||
SHEditorWidgets::CheckBox(label, [tag, &idx]{return tag->GetLayerState(idx);}, [tag, i, idx](bool const& value){tag->SetLayerState(idx, value); SHCollisionTagMatrix::GetTag(idx)->SetLayerState(i, value);}, label.substr(2));
|
if (SHEditorWidgets::CheckBox(label, [tag, &idx] {return tag->GetLayerState(idx); }, [tag, i, idx](bool const& value) {tag->SetLayerState(idx, value); SHCollisionTagMatrix::GetTag(idx)->SetLayerState(i, value); }, label.substr(2)))
|
||||||
|
{
|
||||||
|
isDirty = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
|
@ -64,4 +68,21 @@ namespace SHADE
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SHColliderTagPanel::DrawMenuBar()
|
||||||
|
{
|
||||||
|
if (ImGui::BeginMenuBar())
|
||||||
|
{
|
||||||
|
ImGui::BeginDisabled(!isDirty);
|
||||||
|
if (ImGui::Button("Save"))
|
||||||
|
{
|
||||||
|
std::filesystem::path defaultCollisionTagNameFilePath{ ASSET_ROOT };
|
||||||
|
defaultCollisionTagNameFilePath.append("CollisionTags.SHConfig");
|
||||||
|
SHCollisionTagMatrix::Exit(defaultCollisionTagNameFilePath);
|
||||||
|
isDirty = false;
|
||||||
|
}
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
ImGui::EndMenuBar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -14,6 +14,7 @@ namespace SHADE
|
||||||
//void Exit();
|
//void Exit();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void DrawMenuBar();
|
||||||
bool isDirty;
|
bool isDirty;
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -94,8 +94,8 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
const bool CLEAR_EVENT = C_INFO.GetCollisionState() == SHCollisionInfo::State::EXIT || C_INFO.GetCollisionState() == SHCollisionInfo::State::INVALID;
|
const bool CLEAR_EVENT = C_INFO.GetCollisionState() == SHCollisionInfo::State::EXIT || C_INFO.GetCollisionState() == SHCollisionInfo::State::INVALID;
|
||||||
|
|
||||||
const bool INACTIVE_OBJECT = !SHSceneManager::CheckNodeAndComponentsActive<SHColliderComponent>(C_INFO.GetEntityA())
|
const bool INACTIVE_OBJECT = !SHSceneManager::CheckNodeAndHasComponentsActive<SHColliderComponent>(C_INFO.GetEntityA())
|
||||||
|| !SHSceneManager::CheckNodeAndComponentsActive<SHColliderComponent>(C_INFO.GetEntityB());
|
|| !SHSceneManager::CheckNodeAndHasComponentsActive<SHColliderComponent>(C_INFO.GetEntityB());
|
||||||
|
|
||||||
if (CLEAR_EVENT || INACTIVE_OBJECT)
|
if (CLEAR_EVENT || INACTIVE_OBJECT)
|
||||||
{
|
{
|
||||||
|
|
|
@ -155,7 +155,7 @@ namespace SHADE
|
||||||
// Load start and end points into the container for debug drawing
|
// Load start and end points into the container for debug drawing
|
||||||
#ifdef SHEDITOR
|
#ifdef SHEDITOR
|
||||||
|
|
||||||
SHVec3 endPos = info.ray.position + info.ray.direction * SHRay::MAX_RAYCAST_DIST;
|
SHVec3 endPos = info.ray.position + info.ray.direction * std::clamp(info.distance,0.0f, SHRay::MAX_RAYCAST_DIST);
|
||||||
|
|
||||||
if (!results.empty())
|
if (!results.empty())
|
||||||
endPos = results.back().position;
|
endPos = results.back().position;
|
||||||
|
|
Loading…
Reference in New Issue