Potential fix for incorrect collision states #350
|
@ -5,14 +5,14 @@
|
|||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: 7, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Rotate: {x: 1.48352981, y: 0, z: 0}
|
||||
Scale: {x: 0.999999344, y: 0.999999821, z: 0.999999523}
|
||||
IsActive: true
|
||||
RigidBody Component:
|
||||
Type: Dynamic
|
||||
Drag: 0.00999999978
|
||||
Angular Drag: 0.100000001
|
||||
Use Gravity: false
|
||||
Use Gravity: true
|
||||
Interpolate: false
|
||||
Sleeping Enabled: true
|
||||
Freeze Position X: false
|
||||
|
@ -39,6 +39,8 @@
|
|||
Enabled: true
|
||||
forceAmount: 50
|
||||
torqueAmount: 500
|
||||
- Type: CollisionTest
|
||||
Enabled: true
|
||||
- EID: 1
|
||||
Name: Default
|
||||
IsActive: true
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
using SHADE;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using static Item;
|
||||
|
||||
|
||||
public class CollisionTest : Script
|
||||
{
|
||||
public Collider collider { get; set; }
|
||||
|
||||
private bool printStay = false;
|
||||
|
||||
protected override void awake()
|
||||
{
|
||||
collider = GetComponent<Collider>();
|
||||
}
|
||||
|
||||
protected override void onCollisionEnter(CollisionInfo info)
|
||||
{
|
||||
base.onCollisionEnter(info);
|
||||
Debug.Log("Collision Enter");
|
||||
|
||||
printStay = false;
|
||||
}
|
||||
|
||||
protected override void onCollisionStay(CollisionInfo info)
|
||||
{
|
||||
base.onCollisionStay(info);
|
||||
|
||||
if (!printStay)
|
||||
{
|
||||
Debug.Log("Collision Stay");
|
||||
printStay= true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected override void onCollisionExit(CollisionInfo info)
|
||||
{
|
||||
base.onCollisionExit(info);
|
||||
Debug.Log("Collision Exit");
|
||||
|
||||
printStay = false;
|
||||
}
|
||||
};
|
|
@ -0,0 +1,3 @@
|
|||
Name: CollisionTest
|
||||
ID: 163810535
|
||||
Type: 9
|
|
@ -18,6 +18,7 @@
|
|||
#include "Graphics/MiddleEnd/Interface/SHDebugDrawSystem.h"
|
||||
#include "Math/Transform/SHTransformComponent.h"
|
||||
#include "Physics/System/SHPhysicsSystem.h"
|
||||
#include "Scene/SHSceneManager.h"
|
||||
#include "Tools/Utilities/SHUtilities.h"
|
||||
|
||||
namespace SHADE
|
||||
|
@ -53,14 +54,21 @@ namespace SHADE
|
|||
{
|
||||
const auto& COLLIDER_COMPONENT_DENSE = SHComponentManager::GetDense<SHColliderComponent>();
|
||||
for (const auto& COLLIDER_COMPONENT : COLLIDER_COMPONENT_DENSE)
|
||||
{
|
||||
if (SHSceneManager::CheckNodeAndComponentsActive<SHColliderComponent>(COLLIDER_COMPONENT.GetEID()))
|
||||
drawCollider(debugDrawSystem, COLLIDER_COMPONENT);
|
||||
}
|
||||
}
|
||||
else if (!physicsDebugDrawSystem->collidersToDraw.empty())
|
||||
{
|
||||
for (const auto EID : physicsDebugDrawSystem->collidersToDraw)
|
||||
{
|
||||
if (SHSceneManager::CheckNodeAndHasComponentsActive<SHColliderComponent>(EID))
|
||||
drawCollider(debugDrawSystem, *SHComponentManager::GetComponent<SHColliderComponent>(EID));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
auto* physicsSystem = SHSystemManager::GetSystem<SHPhysicsSystem>();
|
||||
if (!physicsSystem)
|
||||
return;
|
||||
|
|
|
@ -239,6 +239,7 @@ namespace SHADE
|
|||
|
||||
// Unlink with managers
|
||||
objectManager.SetPhysicsWorld(nullptr);
|
||||
collisionListener.ClearContainers();
|
||||
|
||||
return onSceneExitEvent.get()->handle;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue