Skip to content

Commit

Permalink
Updated documentation for supported scale
Browse files Browse the repository at this point in the history
  • Loading branch information
jrouwe committed Dec 4, 2023
1 parent d201faa commit a5f498f
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Jolt/Physics/Collision/Shape/Shape.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ class JPH_EXPORT Shape : public RefTarget<Shape>, public NonCopyable
/// @param ioCollector The transformed shapes will be passed to this collector
virtual void TransformShape(Mat44Arg inCenterOfMassTransform, TransformedShapeCollector &ioCollector) const;

/// Scale this shape. Note that not all shapes support all scales, this will return a shape that matches the scale as accurately as possible.
/// @param inScale The scale to use for this shape (note: this scale is applied to the entire shape in the space it was created, most function apply the scale in the space of the leaf shapes and from the center of mass!)
/// Scale this shape. Note that not all shapes support all scales, this will return a shape that matches the scale as accurately as possible. See Shape::IsValidScale for more information.
/// @param inScale The scale to use for this shape (note: this scale is applied to the entire shape in the space it was created, most other functions apply the scale in the space of the leaf shapes and from the center of mass!)
ShapeResult ScaleShape(Vec3Arg inScale) const;

/// An opaque buffer that holds shape specific information during GetTrianglesStart/Next.
Expand Down Expand Up @@ -409,7 +409,17 @@ class JPH_EXPORT Shape : public RefTarget<Shape>, public NonCopyable
virtual float GetVolume() const = 0;

/// Test if inScale is a valid scale for this shape. Some shapes can only be scaled uniformly, compound shapes cannot handle shapes
/// being rotated and scaled (this would cause shearing). In this case this function will return false.
/// being rotated and scaled (this would cause shearing), scale can never be zero. When the scale is invalid, the function will return false.
///
/// Here's a list of supported scales:
/// * SphereShape: Scale must be uniform (signs of scale are ignored).
/// * BoxShape: Any scale supported (signs of scale are ignored).
/// * TriangleShape: Any scale supported when convex radius is zero, otherwise only uniform scale supported.
/// * CapsuleShape: Scale must be uniform (signs of scale are ignored).
/// * TaperedCapsuleShape: Scale must be uniform (sign of Y scale can be used to flip the capsule).
/// * CylinderShape: Scale must be uniform in XZ plane, Y can scale independently (signs of scale are ignored).
/// * RotatedTranslatedShape: Scale must not cause shear in the child shape.
/// * CompoundShape: Scale must not cause shear in any of the child shapes.
virtual bool IsValidScale(Vec3Arg inScale) const { return !inScale.IsNearZero(); }

#ifdef JPH_DEBUG_RENDERER
Expand Down

0 comments on commit a5f498f

Please sign in to comment.