17 mTransform(inCenterOfMassTransform *
Mat44::sScale(inScale)),
18 mInvTransform(mTransform.Inversed()),
19 mNormalSign(
ScaleHelpers::IsInsideOut(inScale)? -1.0f : 1.0f)
25 mLocalPosition = mInvTransform * inVertex.
GetPosition();
26 mClosestDistanceSq = FLT_MAX;
34 float dist_sq = closest_point.
LengthSq();
35 if (dist_sq < mClosestDistanceSq)
40 mClosestPoint = closest_point;
41 mClosestDistanceSq = dist_sq;
48 if (mClosestDistanceSq < FLT_MAX)
51 Vec3 v0 = mTransform * mV0;
52 Vec3 v1 = mTransform * mV1;
53 Vec3 v2 = mTransform * mV2;
60 float penetration = min(triangle_normal.
Dot(v0 - ioVertex.
GetPosition()), 0.1f);
67 Vec3 closest_point = mTransform * (mLocalPosition + mClosestPoint);
69 if (normal.Dot(triangle_normal) > 0.0f)
71 float normal_length = normal.
Length();
72 float penetration = -normal_length;
#define JPH_EXPORT
Definition: Core.h:236
#define JPH_NAMESPACE_END
Definition: Core.h:378
std::uint32_t uint32
Definition: Core.h:455
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:372
Definition: CollideSoftBodyVertexIterator.h:15
void SetCollision(const Plane &inCollisionPlane, int inCollidingShapeIndex) const
Update the collision of the current vertex.
Definition: CollideSoftBodyVertexIterator.h:93
Vec3 GetPosition() const
Get the position of the current vertex.
Definition: CollideSoftBodyVertexIterator.h:70
bool UpdatePenetration(float inLargestPenetration) const
Definition: CollideSoftBodyVertexIterator.h:83
Collision detection helper that collides soft body vertices vs triangles.
Definition: CollideSoftBodyVerticesVsTriangles.h:14
JPH_INLINE void ProcessTriangle(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2)
Definition: CollideSoftBodyVerticesVsTriangles.h:29
JPH_INLINE void FinishVertex(const CollideSoftBodyVertexIterator &ioVertex, int inCollidingShapeIndex) const
Definition: CollideSoftBodyVerticesVsTriangles.h:46
uint32 mSet
Definition: CollideSoftBodyVerticesVsTriangles.h:87
Mat44 mInvTransform
Definition: CollideSoftBodyVerticesVsTriangles.h:81
Vec3 mLocalPosition
Definition: CollideSoftBodyVerticesVsTriangles.h:82
CollideSoftBodyVerticesVsTriangles(Mat44Arg inCenterOfMassTransform, Vec3Arg inScale)
Definition: CollideSoftBodyVerticesVsTriangles.h:16
float mClosestDistanceSq
Definition: CollideSoftBodyVerticesVsTriangles.h:86
float mNormalSign
Definition: CollideSoftBodyVerticesVsTriangles.h:85
Vec3 mClosestPoint
Definition: CollideSoftBodyVerticesVsTriangles.h:84
Mat44 mTransform
Definition: CollideSoftBodyVerticesVsTriangles.h:80
JPH_INLINE void StartVertex(const CollideSoftBodyVertexIterator &inVertex)
Definition: CollideSoftBodyVerticesVsTriangles.h:23
Vec3 mV0
Definition: CollideSoftBodyVerticesVsTriangles.h:83
Holds a 4x4 matrix of floats, but supports also operations on the 3x3 upper left part of the matrix.
Definition: Mat44.h:13
static Plane sFromPointAndNormal(Vec3Arg inPoint, Vec3Arg inNormal)
Create from point and normal.
Definition: Plane.h:21
JPH_INLINE float Dot(Vec3Arg inV2) const
Dot product.
Definition: Vec3.inl:649
static JPH_INLINE Vec3 sAxisY()
Definition: Vec3.h:54
JPH_INLINE float Length() const
Length of vector.
Definition: Vec3.inl:681
JPH_INLINE Vec3 NormalizedOr(Vec3Arg inZeroValue) const
Normalize vector or return inZeroValue if the length of the vector is zero.
Definition: Vec3.inl:720
JPH_INLINE float LengthSq() const
Squared length of vector.
Definition: Vec3.inl:665
Vec3 GetClosestPointOnTriangle(Vec3Arg inA, Vec3Arg inB, Vec3Arg inC, uint32 &outSet)
Definition: ClosestPoint.h:160
Helper functions to get properties of a scaling vector.
Definition: ScaleHelpers.h:13