Collision shapes will only be added to broadphase if the collider is active

This commit is contained in:
Diren D Bharwani 2023-03-04 13:30:29 +08:00
parent 6200e3f533
commit e2d96569b5
6 changed files with 55 additions and 29973 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
NumberOfChildren: 0
Components:
Camera Component:
Position: {x: 1, y: 5, z: 5}
Position: {x: 0, y: 2, z: 5}
Pitch: 0
Yaw: 0
Roll: 0
@ -28,9 +28,9 @@
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 6
Type: Sphere
Radius: 1
Collision Tag: 0
Type: Box
Half Extents: {x: 1, y: 1, z: 1}
Friction: 0.400000006
Bounciness: 0
Density: 1
@ -41,17 +41,17 @@
- EID: 3
Name: Default
IsActive: true
NumberOfChildren: 0
NumberOfChildren: 1
Components:
Transform Component:
Translate: {x: 0, y: 5, z: 0}
Rotate: {x: -0, y: 0.785398006, z: -0}
Scale: {x: 1, y: 1, z: 1}
Translate: {x: -0.597273231, y: 5, z: 0}
Rotate: {x: -0, y: 0, z: 0.490080804}
Scale: {x: 0.999999702, y: 0.999999702, z: 1}
IsActive: true
RigidBody Component:
Type: Dynamic
Type: Static
Auto Mass: false
Mass: 1
Mass: .inf
Drag: 0.00999999978
Angular Drag: 0.00999999978
Use Gravity: true
@ -82,3 +82,43 @@
Enabled: true
forceAmount: 50
torqueAmount: 25
- EID: 2
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -2, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
RigidBody Component:
Type: Dynamic
Auto Mass: false
Mass: 1
Drag: 0.00999999978
Angular Drag: 0.00999999978
Use Gravity: true
Gravity Scale: 1
Interpolate: true
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
Freeze Rotation X: false
Freeze Rotation Y: false
Freeze Rotation Z: false
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Type: Sphere
Radius: 1
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Scripts: ~

View File

@ -100,7 +100,8 @@ namespace SHADE
shapes.emplace_back(sphere);
if (broadphase)
// Only add shapes to the broadphase if the collider is active
if (IsActive() && broadphase)
broadphase->Insert(NEW_SHAPE_ID, sphere->ComputeAABB());
// Broadcast Event for adding a shape
@ -153,7 +154,7 @@ namespace SHADE
shapes.emplace_back(box);
if (broadphase)
if (IsActive() && broadphase)
broadphase->Insert(NEW_SHAPE_ID, box->ComputeAABB());
// Broadcast Event for adding a shape

View File

@ -87,10 +87,6 @@ namespace SHADE
transformComponent->SetWorldPosition(MOTION_STATE.position);
transformComponent->SetWorldOrientation(MOTION_STATE.orientation);
}
/*
* TODO: Test if the scene graph transforms abides by setting world position. Collisions will ignore the scene graph hierarchy.
*/
}
}
}