Skip to content

Commit fd0fd3b

Browse files
[Dependencies] Update Jolt Physics;
1 parent 266223d commit fd0fd3b

13 files changed

Lines changed: 46 additions & 31 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:7bc9bdcaee867d1570403edfaf3a82c4f82e2785f5a9361816990565857a05f5
3+
size 5120
-399 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
550ad22e8ea379c0b64d6150c56342b4c37bb10a
1+
48d2f26d476f36d1140cba6ba269c70e54888214

Engine/Staple.JoltPhysics/JoltPhysics/JoltPhysics3D.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ private void OnContactRemoved(PhysicsSystem system, ref SubShapeIDPair subShapeP
282282
}
283283
}
284284

285-
private ValidateResult OnContactValidate(PhysicsSystem system, in Body body1, in Body body2, Double3 baseOffset, in CollideShapeResult collisionResult)
285+
private ValidateResult OnContactValidate(PhysicsSystem system, in Body body1, in Body body2, RVector3 baseOffset,
286+
in CollideShapeResult collisionResult)
286287
{
287288
lock (threadLock)
288289
{
@@ -699,7 +700,7 @@ public bool CreateHeightMap(Entity entity, float[] heights, Vector3 offset, Vect
699700
{
700701
fixed(float *ptr = heights)
701702
{
702-
return CreateBody(entity, new HeightFieldShapeSettings(ptr, offset, scale, (int)Math.Sqrt(heights.Length)),
703+
return CreateBody(entity, new HeightFieldShapeSettings(ptr, offset, scale, (uint)Math.Sqrt(heights.Length)),
703704
position, rotation, MotionType.Static, layer, false, 0, friction, restitution, true, true, true, false,
704705
mass, out body);
705706
}
@@ -877,7 +878,7 @@ public IBody3D CreateBody(Entity entity, World world)
877878
fixed(float *ptr = heightMap.heights)
878879
{
879880
compound.AddShape(heightMap.position, heightMap.rotation.SafeNormalize(),
880-
new HeightFieldShapeSettings(ptr, heightMap.offset, heightMap.scale, (int)Math.Sqrt(heightMap.heights.Length)));
881+
new HeightFieldShapeSettings(ptr, heightMap.offset, heightMap.scale, (uint)Math.Sqrt(heightMap.heights.Length)));
881882
}
882883
}
883884
}

Staging/Packages/com.staple.joltphysics/JoltPhysics/JoltPhysics3D.cs

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public void Startup()
5858
{
5959
destroyed = false;
6060

61-
if(JoltPhysicsSharp.Foundation.Init() == false)
61+
if(!JoltPhysicsSharp.Foundation.Init())
6262
{
6363
throw new InvalidOperationException("[JoltPhysics] Failed to initialize Foundation");
6464
}
@@ -282,7 +282,8 @@ private void OnContactRemoved(PhysicsSystem system, ref SubShapeIDPair subShapeP
282282
}
283283
}
284284

285-
private ValidateResult OnContactValidate(PhysicsSystem system, in Body body1, in Body body2, Double3 baseOffset, in CollideShapeResult collisionResult)
285+
private ValidateResult OnContactValidate(PhysicsSystem system, in Body body1, in Body body2, RVector3 baseOffset,
286+
in CollideShapeResult collisionResult)
286287
{
287288
lock (threadLock)
288289
{
@@ -291,7 +292,7 @@ private ValidateResult OnContactValidate(PhysicsSystem system, in Body body1, in
291292

292293
if (TryFindBody(body1, out var b1) && TryFindBody(body2, out var b2))
293294
{
294-
if(Physics3D.Instance.ContactValidate(b1, b2) == false)
295+
if(!Physics3D.Instance.ContactValidate(b1, b2))
295296
{
296297
lock (threadLock)
297298
{
@@ -383,7 +384,7 @@ public void Update(float deltaTime)
383384
{
384385
var p = pair.Value;
385386

386-
if (p.body.IsActive == false)
387+
if (!p.body.IsActive)
387388
{
388389
continue;
389390
}
@@ -405,7 +406,7 @@ public void Update(float deltaTime)
405406
{
406407
var p = pair.Value;
407408

408-
if(p.enabled == false)
409+
if(!p.enabled)
409410
{
410411
continue;
411412
}
@@ -439,14 +440,14 @@ private void Simulate()
439440
p.previousRotation = p.currentRotation;
440441
}
441442

442-
if (p.entity.EnabledInHierarchy == false)
443+
if (!p.entity.EnabledInHierarchy)
443444
{
444445
if (p.body.IsActive)
445446
{
446447
physicsSystem.BodyInterface.DeactivateBody(p.body.ID);
447448
}
448449
}
449-
else if (p.body.IsActive == false)
450+
else if (!p.body.IsActive)
450451
{
451452
physicsSystem.BodyInterface.ActivateBody(p.body.ID);
452453
}
@@ -462,7 +463,7 @@ private void Simulate()
462463
p.previousRotation = p.currentRotation;
463464
}
464465

465-
if (p.entity.EnabledInHierarchy == false)
466+
if (!p.entity.EnabledInHierarchy)
466467
{
467468
if (p.enabled)
468469
{
@@ -471,7 +472,7 @@ private void Simulate()
471472
p.character.RemoveFromPhysicsSystem();
472473
}
473474
}
474-
else if (p.enabled == false)
475+
else if (!p.enabled)
475476
{
476477
p.enabled = true;
477478

@@ -490,15 +491,15 @@ private void Simulate()
490491
{
491492
var p = pair.Value;
492493

493-
if (p.body.IsActive == false)
494+
if (!p.body.IsActive)
494495
{
495496
continue;
496497
}
497498

498499
p.currentPosition = p.body.Position;
499500
p.currentRotation = p.body.Rotation;
500501

501-
if (Physics.InterpolatePhysics == false && p.transform != null)
502+
if (!Physics.InterpolatePhysics && p.transform != null)
502503
{
503504
p.transform.Position = p.currentPosition;
504505
p.transform.Rotation = p.currentRotation;
@@ -509,14 +510,14 @@ private void Simulate()
509510
{
510511
var p = pair.Value;
511512

512-
if (p.enabled == false)
513+
if (!p.enabled)
513514
{
514515
continue;
515516
}
516517

517518
(p.currentPosition, p.currentRotation) = p.character.GetPositionAndRotation();
518519

519-
if (Physics.InterpolatePhysics == false && p.transform != null)
520+
if (!Physics.InterpolatePhysics && p.transform != null)
520521
{
521522
p.transform.Position = p.currentPosition;
522523
p.transform.Rotation = p.currentRotation;
@@ -594,22 +595,22 @@ private bool CreateBody(Entity entity, ShapeSettings settings, Vector3 position,
594595
AllowedDOFs.TranslationY
595596
};
596597

597-
if (freezeX == false)
598+
if (!freezeX)
598599
{
599600
dofs.Add(AllowedDOFs.RotationX);
600601
}
601602

602-
if (freezeY == false)
603+
if (!freezeY)
603604
{
604605
dofs.Add(AllowedDOFs.RotationY);
605606
}
606607

607-
if (freezeZ == false)
608+
if (!freezeZ)
608609
{
609610
dofs.Add(AllowedDOFs.RotationZ);
610611
}
611612

612-
if (is2DPlane == false)
613+
if (!is2DPlane)
613614
{
614615
dofs.Add(AllowedDOFs.TranslationZ);
615616
}
@@ -699,7 +700,7 @@ public bool CreateHeightMap(Entity entity, float[] heights, Vector3 offset, Vect
699700
{
700701
fixed(float *ptr = heights)
701702
{
702-
return CreateBody(entity, new HeightFieldShapeSettings(ptr, offset, scale, (int)Math.Sqrt(heights.Length)),
703+
return CreateBody(entity, new HeightFieldShapeSettings(ptr, offset, scale, (uint)Math.Sqrt(heights.Length)),
703704
position, rotation, MotionType.Static, layer, false, 0, friction, restitution, true, true, true, false,
704705
mass, out body);
705706
}
@@ -792,7 +793,7 @@ public bool CreateMesh(Entity entity, Mesh mesh, Vector3 position, Quaternion ro
792793
throw new NullReferenceException("Mesh is null");
793794
}
794795

795-
if(mesh.isReadable == false)
796+
if(!mesh.isReadable)
796797
{
797798
throw new ArgumentException("Mesh is not readable", nameof(mesh));
798799
}
@@ -846,14 +847,14 @@ public IBody3D CreateBody(Entity entity, World world)
846847
RigidBody3D rigidBody = null;
847848
Character3D character = null;
848849

849-
if (world.TryGetComponent(entity, out rigidBody) == false && world.TryGetComponent(entity, out character) == false)
850+
if (!world.TryGetComponent(entity, out rigidBody) && !world.TryGetComponent(entity, out character))
850851
{
851852
Log.Debug($"[Physics3D] Failed to create body for entity {world.GetEntityName(entity)}: No RigidBody3D or Character3D component found");
852853

853854
return null;
854855
}
855856

856-
if (world.TryGetComponent<Transform>(entity, out var transform) == false)
857+
if (!world.TryGetComponent<Transform>(entity, out var transform))
857858
{
858859
Log.Debug($"[Physics3D] Failed to create body for entity {world.GetEntityName(entity)}: No Transform component found");
859860

@@ -877,7 +878,7 @@ public IBody3D CreateBody(Entity entity, World world)
877878
fixed(float *ptr = heightMap.heights)
878879
{
879880
compound.AddShape(heightMap.position, heightMap.rotation.SafeNormalize(),
880-
new HeightFieldShapeSettings(ptr, heightMap.offset, heightMap.scale, (int)Math.Sqrt(heightMap.heights.Length)));
881+
new HeightFieldShapeSettings(ptr, heightMap.offset, heightMap.scale, (uint)Math.Sqrt(heightMap.heights.Length)));
881882
}
882883
}
883884
}
@@ -971,7 +972,7 @@ public IBody3D CreateBody(Entity entity, World world)
971972
throw new NullReferenceException($"MeshCollider3D {world.GetEntityName(entity)} Mesh is null");
972973
}
973974

974-
if (mesh.isReadable == false)
975+
if (!mesh.isReadable)
975976
{
976977
throw new ArgumentException($"MeshCollider3D {world.GetEntityName(entity)} Mesh is not readable", nameof(mesh));
977978
}
@@ -1008,7 +1009,7 @@ public IBody3D CreateBody(Entity entity, World world)
10081009
compound.AddShape(meshCollider.position, meshCollider.rotation.SafeNormalize(), settings);
10091010
}
10101011

1011-
if(any == false)
1012+
if(!any)
10121013
{
10131014
Log.Error($"[Physics3D] Rigid Body for entity {world.GetEntityName(entity)} has no attached colliders, ignoring...");
10141015

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:7bc9bdcaee867d1570403edfaf3a82c4f82e2785f5a9361816990565857a05f5
3+
size 5120
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"guid": "1b87a08b-8db1-4c39-b8d5-ae74d7e3d9e8",
3+
"autoReferenced": false,
4+
"anyPlatform": true,
5+
"platforms": [],
6+
"typeName": "Staple.Editor.PluginAsset"
7+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:83e60919e0cfa94e3305b94a8db605bac8f16c1c18ef583d1f84e807970302a5
3-
size 408576
2+
oid sha256:4464ca484e4c8d847375c13a579f3dd96d4f1bb47c9a25efa85ccd09db17ae66
3+
size 442880
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
550ad22e8ea379c0b64d6150c56342b4c37bb10a
1+
48d2f26d476f36d1140cba6ba269c70e54888214
Binary file not shown.

0 commit comments

Comments
 (0)