Explorar o código

Updated documentation for EmptyShape

Body::sFixedToWorld now also uses EmptyShape
Jorrit Rouwe hai 11 meses
pai
achega
c244674f03
Modificáronse 2 ficheiros con 9 adicións e 2 borrados
  1. 2 2
      Jolt/Physics/Body/Body.cpp
  2. 7 0
      Jolt/Physics/Collision/Shape/EmptyShape.h

+ 2 - 2
Jolt/Physics/Body/Body.cpp

@@ -10,7 +10,7 @@
 #include <Jolt/Physics/SoftBody/SoftBodyMotionProperties.h>
 #include <Jolt/Physics/PhysicsSettings.h>
 #include <Jolt/Physics/StateRecorder.h>
-#include <Jolt/Physics/Collision/Shape/SphereShape.h>
+#include <Jolt/Physics/Collision/Shape/EmptyShape.h>
 #include <Jolt/Core/StringTools.h>
 #include <Jolt/Core/Profiler.h>
 #ifdef JPH_DEBUG_RENDERER
@@ -19,7 +19,7 @@
 
 JPH_NAMESPACE_BEGIN
 
-static const SphereShape sFixedToWorldShape(FLT_EPSILON);
+static const EmptyShape sFixedToWorldShape;
 Body Body::sFixedToWorld(false);
 
 Body::Body(bool) :

+ 7 - 0
Jolt/Physics/Collision/Shape/EmptyShape.h

@@ -24,6 +24,13 @@ public:
 };
 
 /// An empty shape that has no volume and collides with nothing.
+///
+/// Possible use cases:
+/// - As a placeholder for a shape that will be created later. E.g. if you first need to create a body and only then know what shape it will have.
+/// - If you need a kinematic body to attach a constraint to, but you don't want the body to collide with anything.
+///
+/// Note that, if possible, you should also put your body in an ObjectLayer that doesn't collide with anything.
+/// This ensures that collisions will be filtered out at broad phase level instead of at narrow phase level, this is more efficient.
 class JPH_EXPORT EmptyShape final : public Shape
 {
 public: