Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
AxisConstraintPart.h
Go to the documentation of this file.
1// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
2// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
11
13
42{
44 template <EMotionType Type1, EMotionType Type2>
45 JPH_INLINE bool ApplyVelocityStep(MotionProperties *ioMotionProperties1, MotionProperties *ioMotionProperties2, Vec3Arg inWorldSpaceAxis, float inLambda) const
46 {
47 // Apply impulse if delta is not zero
48 if (inLambda != 0.0f)
49 {
50 // Calculate velocity change due to constraint
51 //
52 // Impulse:
53 // P = J^T lambda
54 //
55 // Euler velocity integration:
56 // v' = v + M^-1 P
57 if constexpr (Type1 == EMotionType::Dynamic)
58 {
59 ioMotionProperties1->SubLinearVelocityStep((inLambda * ioMotionProperties1->GetInverseMass()) * inWorldSpaceAxis);
60 ioMotionProperties1->SubAngularVelocityStep(inLambda * Vec3::sLoadFloat3Unsafe(mInvI1_R1PlusUxAxis));
61 }
62 if constexpr (Type2 == EMotionType::Dynamic)
63 {
64 ioMotionProperties2->AddLinearVelocityStep((inLambda * ioMotionProperties2->GetInverseMass()) * inWorldSpaceAxis);
65 ioMotionProperties2->AddAngularVelocityStep(inLambda * Vec3::sLoadFloat3Unsafe(mInvI2_R2xAxis));
66 }
67 return true;
68 }
69
70 return false;
71 }
72
73public:
75 template <EMotionType Type1, EMotionType Type2>
76 JPH_INLINE void TemplatedCalculateConstraintProperties(float inDeltaTime, const MotionProperties *inMotionProperties1, Mat44Arg inInvI1, Vec3Arg inR1PlusU, const MotionProperties *inMotionProperties2, Mat44Arg inInvI2, Vec3Arg inR2, Vec3Arg inWorldSpaceAxis, float inBias = 0.0f, float inC = 0.0f, float inFrequency = 0.0f, float inDamping = 0.0f)
77 {
78 JPH_ASSERT(inWorldSpaceAxis.IsNormalized(1.0e-5f));
79
80 // Calculate properties used below
81 Vec3 r1_plus_u_x_axis;
82 if constexpr (Type1 != EMotionType::Static)
83 {
84 r1_plus_u_x_axis = inR1PlusU.Cross(inWorldSpaceAxis);
85 r1_plus_u_x_axis.StoreFloat3(&mR1PlusUxAxis);
86 }
87 JPH_IF_DEBUG(else Vec3::sNaN().StoreFloat3(&mR1PlusUxAxis);)
88
89 Vec3 r2_x_axis;
90 if constexpr (Type2 != EMotionType::Static)
91 {
92 r2_x_axis = inR2.Cross(inWorldSpaceAxis);
93 r2_x_axis.StoreFloat3(&mR2xAxis);
94 }
95 JPH_IF_DEBUG(else Vec3::sNaN().StoreFloat3(&mR2xAxis);)
96
97 // Calculate inverse effective mass: K = J M^-1 J^T
98 float inv_effective_mass;
99
100 if constexpr (Type1 == EMotionType::Dynamic)
101 {
102 Vec3 invi1_r1_plus_u_x_axis = inInvI1.Multiply3x3(r1_plus_u_x_axis);
103 invi1_r1_plus_u_x_axis.StoreFloat3(&mInvI1_R1PlusUxAxis);
104 inv_effective_mass = inMotionProperties1->GetInverseMass() + invi1_r1_plus_u_x_axis.Dot(r1_plus_u_x_axis);
105 }
106 else
107 {
108 (void)r1_plus_u_x_axis; // Fix compiler warning: Not using this (it's not calculated either)
109 JPH_IF_DEBUG(Vec3::sNaN().StoreFloat3(&mInvI1_R1PlusUxAxis);)
110 inv_effective_mass = 0.0f;
111 }
112
113 if constexpr (Type2 == EMotionType::Dynamic)
114 {
115 Vec3 invi2_r2_x_axis = inInvI2.Multiply3x3(r2_x_axis);
116 invi2_r2_x_axis.StoreFloat3(&mInvI2_R2xAxis);
117 inv_effective_mass += inMotionProperties2->GetInverseMass() + invi2_r2_x_axis.Dot(r2_x_axis);
118 }
119 else
120 {
121 (void)r2_x_axis; // Fix compiler warning: Not using this (it's not calculated either)
122 JPH_IF_DEBUG(Vec3::sNaN().StoreFloat3(&mInvI2_R2xAxis);)
123 }
124
125 // Calculate effective mass and spring properties
126 mSpringPart.CalculateSpringProperties(inDeltaTime, inv_effective_mass, inBias, inC, inFrequency, inDamping, mEffectiveMass);
127
128 JPH_DET_LOG("TemplatedCalculateConstraintProperties: dt: " << inDeltaTime << " invI1: " << inInvI1 << " r1PlusU: " << inR1PlusU << " invI2: " << inInvI2 << " r2: " << inR2 << " bias: " << inBias << ", c: " << inC << ", frequency: " << inFrequency << ", damping: " << inDamping << " r1PlusUxAxis: " << mR1PlusUxAxis << " r2xAxis: " << mR2xAxis << " invI1_R1PlusUxAxis: " << mInvI1_R1PlusUxAxis << " invI2_R2xAxis: " << mInvI2_R2xAxis << " effectiveMass: " << mEffectiveMass << " totalLambda: " << mTotalLambda);
129 }
130
142 inline void CalculateConstraintProperties(float inDeltaTime, const Body &inBody1, Vec3Arg inR1PlusU, const Body &inBody2, Vec3Arg inR2, Vec3Arg inWorldSpaceAxis, float inBias = 0.0f, float inC = 0.0f, float inFrequency = 0.0f, float inDamping = 0.0f)
143 {
144 // Dispatch to the correct templated form
145 switch (inBody1.GetMotionType())
146 {
147 case EMotionType::Dynamic:
148 {
149 const MotionProperties *mp1 = inBody1.GetMotionPropertiesUnchecked();
150 Mat44 invi1 = inBody1.GetInverseInertia();
151 switch (inBody2.GetMotionType())
152 {
153 case EMotionType::Dynamic:
154 TemplatedCalculateConstraintProperties<EMotionType::Dynamic, EMotionType::Dynamic>(inDeltaTime, mp1, invi1, inR1PlusU, inBody2.GetMotionPropertiesUnchecked(), inBody2.GetInverseInertia(), inR2, inWorldSpaceAxis, inBias, inC, inFrequency, inDamping);
155 break;
156
157 case EMotionType::Kinematic:
158 TemplatedCalculateConstraintProperties<EMotionType::Dynamic, EMotionType::Kinematic>(inDeltaTime, mp1, invi1, inR1PlusU, nullptr, Mat44() /* Will not be used */, inR2, inWorldSpaceAxis, inBias, inC, inFrequency, inDamping);
159 break;
160
161 case EMotionType::Static:
162 TemplatedCalculateConstraintProperties<EMotionType::Dynamic, EMotionType::Static>(inDeltaTime, mp1, invi1, inR1PlusU, nullptr, Mat44() /* Will not be used */, inR2, inWorldSpaceAxis, inBias, inC, inFrequency, inDamping);
163 break;
164
165 default:
166 JPH_ASSERT(false);
167 break;
168 }
169 break;
170 }
171
172 case EMotionType::Kinematic:
173 JPH_ASSERT(inBody2.IsDynamic());
174 TemplatedCalculateConstraintProperties<EMotionType::Kinematic, EMotionType::Dynamic>(inDeltaTime, nullptr, Mat44() /* Will not be used */, inR1PlusU, inBody2.GetMotionPropertiesUnchecked(), inBody2.GetInverseInertia(), inR2, inWorldSpaceAxis, inBias, inC, inFrequency, inDamping);
175 break;
176
177 case EMotionType::Static:
178 JPH_ASSERT(inBody2.IsDynamic());
179 TemplatedCalculateConstraintProperties<EMotionType::Static, EMotionType::Dynamic>(inDeltaTime, nullptr, Mat44() /* Will not be used */, inR1PlusU, inBody2.GetMotionPropertiesUnchecked(), inBody2.GetInverseInertia(), inR2, inWorldSpaceAxis, inBias, inC, inFrequency, inDamping);
180 break;
181
182 default:
183 JPH_ASSERT(false);
184 break;
185 }
186 }
187
189 inline void Deactivate()
190 {
191 mEffectiveMass = 0.0f;
192 mTotalLambda = 0.0f;
193 }
194
196 inline bool IsActive() const
197 {
198 return mEffectiveMass != 0.0f;
199 }
200
202 template <EMotionType Type1, EMotionType Type2>
203 inline void TemplatedWarmStart(MotionProperties *ioMotionProperties1, MotionProperties *ioMotionProperties2, Vec3Arg inWorldSpaceAxis, float inWarmStartImpulseRatio)
204 {
205 mTotalLambda *= inWarmStartImpulseRatio;
206
207 ApplyVelocityStep<Type1, Type2>(ioMotionProperties1, ioMotionProperties2, inWorldSpaceAxis, mTotalLambda);
208 }
209
215 inline void WarmStart(Body &ioBody1, Body &ioBody2, Vec3Arg inWorldSpaceAxis, float inWarmStartImpulseRatio)
216 {
217 EMotionType motion_type1 = ioBody1.GetMotionType();
218 MotionProperties *motion_properties1 = ioBody1.GetMotionPropertiesUnchecked();
219
220 EMotionType motion_type2 = ioBody2.GetMotionType();
221 MotionProperties *motion_properties2 = ioBody2.GetMotionPropertiesUnchecked();
222
223 // Dispatch to the correct templated form
224 // Note: Warm starting doesn't differentiate between kinematic/static bodies so we handle both as static bodies
225 if (motion_type1 == EMotionType::Dynamic)
226 {
227 if (motion_type2 == EMotionType::Dynamic)
228 TemplatedWarmStart<EMotionType::Dynamic, EMotionType::Dynamic>(motion_properties1, motion_properties2, inWorldSpaceAxis, inWarmStartImpulseRatio);
229 else
230 TemplatedWarmStart<EMotionType::Dynamic, EMotionType::Static>(motion_properties1, motion_properties2, inWorldSpaceAxis, inWarmStartImpulseRatio);
231 }
232 else
233 {
234 JPH_ASSERT(motion_type2 == EMotionType::Dynamic);
235 TemplatedWarmStart<EMotionType::Static, EMotionType::Dynamic>(motion_properties1, motion_properties2, inWorldSpaceAxis, inWarmStartImpulseRatio);
236 }
237 }
238
240 template <EMotionType Type1, EMotionType Type2>
241 inline bool TemplatedSolveVelocityConstraint(MotionProperties *ioMotionProperties1, MotionProperties *ioMotionProperties2, Vec3Arg inWorldSpaceAxis, float inMinLambda, float inMaxLambda)
242 {
243 // Calculate jacobian multiplied by linear velocity
244 float jv;
245 if constexpr (Type1 != EMotionType::Static && Type2 != EMotionType::Static)
246 jv = inWorldSpaceAxis.Dot(ioMotionProperties1->GetLinearVelocity() - ioMotionProperties2->GetLinearVelocity());
247 else if constexpr (Type1 != EMotionType::Static)
248 jv = inWorldSpaceAxis.Dot(ioMotionProperties1->GetLinearVelocity());
249 else if constexpr (Type2 != EMotionType::Static)
250 jv = inWorldSpaceAxis.Dot(-ioMotionProperties2->GetLinearVelocity());
251 else
252 JPH_ASSERT(false); // Static vs static is nonsensical!
253
254 // Calculate jacobian multiplied by angular velocity
255 if constexpr (Type1 != EMotionType::Static)
256 jv += Vec3::sLoadFloat3Unsafe(mR1PlusUxAxis).Dot(ioMotionProperties1->GetAngularVelocity());
257 if constexpr (Type2 != EMotionType::Static)
258 jv -= Vec3::sLoadFloat3Unsafe(mR2xAxis).Dot(ioMotionProperties2->GetAngularVelocity());
259
260 // Lagrange multiplier is:
261 //
262 // lambda = -K^-1 (J v + b)
263 float lambda = mEffectiveMass * (jv - mSpringPart.GetBias(mTotalLambda));
264 float new_lambda = Clamp(mTotalLambda + lambda, inMinLambda, inMaxLambda); // Clamp impulse
265 lambda = new_lambda - mTotalLambda; // Lambda potentially got clamped, calculate the new impulse to apply
266 mTotalLambda = new_lambda; // Store accumulated impulse
267
268 return ApplyVelocityStep<Type1, Type2>(ioMotionProperties1, ioMotionProperties2, inWorldSpaceAxis, lambda);
269 }
270
277 inline bool SolveVelocityConstraint(Body &ioBody1, Body &ioBody2, Vec3Arg inWorldSpaceAxis, float inMinLambda, float inMaxLambda)
278 {
279 EMotionType motion_type1 = ioBody1.GetMotionType();
280 MotionProperties *motion_properties1 = ioBody1.GetMotionPropertiesUnchecked();
281
282 EMotionType motion_type2 = ioBody2.GetMotionType();
283 MotionProperties *motion_properties2 = ioBody2.GetMotionPropertiesUnchecked();
284
285 // Dispatch to the correct templated form
286 switch (motion_type1)
287 {
288 case EMotionType::Dynamic:
289 switch (motion_type2)
290 {
291 case EMotionType::Dynamic:
292 return TemplatedSolveVelocityConstraint<EMotionType::Dynamic, EMotionType::Dynamic>(motion_properties1, motion_properties2, inWorldSpaceAxis, inMinLambda, inMaxLambda);
293
294 case EMotionType::Kinematic:
295 return TemplatedSolveVelocityConstraint<EMotionType::Dynamic, EMotionType::Kinematic>(motion_properties1, motion_properties2, inWorldSpaceAxis, inMinLambda, inMaxLambda);
296
297 case EMotionType::Static:
298 return TemplatedSolveVelocityConstraint<EMotionType::Dynamic, EMotionType::Static>(motion_properties1, motion_properties2, inWorldSpaceAxis, inMinLambda, inMaxLambda);
299
300 default:
301 JPH_ASSERT(false);
302 break;
303 }
304 break;
305
306 case EMotionType::Kinematic:
307 JPH_ASSERT(motion_type2 == EMotionType::Dynamic);
308 return TemplatedSolveVelocityConstraint<EMotionType::Kinematic, EMotionType::Dynamic>(motion_properties1, motion_properties2, inWorldSpaceAxis, inMinLambda, inMaxLambda);
309
310 case EMotionType::Static:
311 JPH_ASSERT(motion_type2 == EMotionType::Dynamic);
312 return TemplatedSolveVelocityConstraint<EMotionType::Static, EMotionType::Dynamic>(motion_properties1, motion_properties2, inWorldSpaceAxis, inMinLambda, inMaxLambda);
313
314 default:
315 JPH_ASSERT(false);
316 break;
317 }
318
319 return false;
320 }
321
328 inline bool SolvePositionConstraint(Body &ioBody1, Body &ioBody2, Vec3Arg inWorldSpaceAxis, float inC, float inBaumgarte) const
329 {
330 // Only apply position constraint when the constraint is hard, otherwise the velocity bias will fix the constraint
331 if (inC != 0.0f && !mSpringPart.IsActive())
332 {
333 // Calculate lagrange multiplier (lambda) for Baumgarte stabilization:
334 //
335 // lambda = -K^-1 * beta / dt * C
336 //
337 // We should divide by inDeltaTime, but we should multiply by inDeltaTime in the Euler step below so they're cancelled out
338 float lambda = -mEffectiveMass * inBaumgarte * inC;
339
340 // Directly integrate velocity change for one time step
341 //
342 // Euler velocity integration:
343 // dv = M^-1 P
344 //
345 // Impulse:
346 // P = J^T lambda
347 //
348 // Euler position integration:
349 // x' = x + dv * dt
350 //
351 // Note we don't accumulate velocities for the stabilization. This is using the approach described in 'Modeling and
352 // Solving Constraints' by Erin Catto presented at GDC 2007. On slide 78 it is suggested to split up the Baumgarte
353 // stabilization for positional drift so that it does not actually add to the momentum. We combine an Euler velocity
354 // integrate + a position integrate and then discard the velocity change.
355 if (ioBody1.IsDynamic())
356 {
357 ioBody1.SubPositionStep((lambda * ioBody1.GetMotionPropertiesUnchecked()->GetInverseMass()) * inWorldSpaceAxis);
358 ioBody1.SubRotationStep(lambda * Vec3::sLoadFloat3Unsafe(mInvI1_R1PlusUxAxis));
359 }
360 if (ioBody2.IsDynamic())
361 {
362 ioBody2.AddPositionStep((lambda * ioBody2.GetMotionPropertiesUnchecked()->GetInverseMass()) * inWorldSpaceAxis);
363 ioBody2.AddRotationStep(lambda * Vec3::sLoadFloat3Unsafe(mInvI2_R2xAxis));
364 }
365 return true;
366 }
367
368 return false;
369 }
370
372 inline void SetTotalLambda(float inLambda)
373 {
374 mTotalLambda = inLambda;
375 }
376
378 inline float GetTotalLambda() const
379 {
380 return mTotalLambda;
381 }
382
384 void SaveState(StateRecorder &inStream) const
385 {
386 inStream.Write(mTotalLambda);
387 }
388
391 {
392 inStream.Read(mTotalLambda);
393 }
394
395private:
396 Float3 mR1PlusUxAxis;
397 Float3 mR2xAxis;
398 Float3 mInvI1_R1PlusUxAxis;
399 Float3 mInvI2_R2xAxis;
400 float mEffectiveMass = 0.0f;
401 SpringPart mSpringPart;
402 float mTotalLambda = 0.0f;
403};
404
#define JPH_IF_DEBUG(...)
Definition: Core.h:354
#define JPH_NAMESPACE_END
Definition: Core.h:240
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:234
#define JPH_DET_LOG(...)
By default we log nothing.
Definition: DeterminismLog.h:155
#define JPH_ASSERT(...)
Definition: IssueReporting.h:33
constexpr T Clamp(T inV, T inMin, T inMax)
Clamp a value between two values.
Definition: Math.h:45
EMotionType
Motion type of a physics body.
Definition: MotionType.h:11
Definition: AxisConstraintPart.h:42
float GetTotalLambda() const
Return lagrange multiplier.
Definition: AxisConstraintPart.h:378
bool SolveVelocityConstraint(Body &ioBody1, Body &ioBody2, Vec3Arg inWorldSpaceAxis, float inMinLambda, float inMaxLambda)
Definition: AxisConstraintPart.h:277
void CalculateConstraintProperties(float inDeltaTime, const Body &inBody1, Vec3Arg inR1PlusU, const Body &inBody2, Vec3Arg inR2, Vec3Arg inWorldSpaceAxis, float inBias=0.0f, float inC=0.0f, float inFrequency=0.0f, float inDamping=0.0f)
Definition: AxisConstraintPart.h:142
bool SolvePositionConstraint(Body &ioBody1, Body &ioBody2, Vec3Arg inWorldSpaceAxis, float inC, float inBaumgarte) const
Definition: AxisConstraintPart.h:328
bool IsActive() const
Check if constraint is active.
Definition: AxisConstraintPart.h:196
void SetTotalLambda(float inLambda)
Override total lagrange multiplier, can be used to set the initial value for warm starting.
Definition: AxisConstraintPart.h:372
void WarmStart(Body &ioBody1, Body &ioBody2, Vec3Arg inWorldSpaceAxis, float inWarmStartImpulseRatio)
Definition: AxisConstraintPart.h:215
bool TemplatedSolveVelocityConstraint(MotionProperties *ioMotionProperties1, MotionProperties *ioMotionProperties2, Vec3Arg inWorldSpaceAxis, float inMinLambda, float inMaxLambda)
Templated form of SolveVelocityConstraint with the motion types baked in.
Definition: AxisConstraintPart.h:241
void Deactivate()
Deactivate this constraint.
Definition: AxisConstraintPart.h:189
void TemplatedWarmStart(MotionProperties *ioMotionProperties1, MotionProperties *ioMotionProperties2, Vec3Arg inWorldSpaceAxis, float inWarmStartImpulseRatio)
Templated form of WarmStart with the motion types baked in.
Definition: AxisConstraintPart.h:203
JPH_INLINE void TemplatedCalculateConstraintProperties(float inDeltaTime, const MotionProperties *inMotionProperties1, Mat44Arg inInvI1, Vec3Arg inR1PlusU, const MotionProperties *inMotionProperties2, Mat44Arg inInvI2, Vec3Arg inR2, Vec3Arg inWorldSpaceAxis, float inBias=0.0f, float inC=0.0f, float inFrequency=0.0f, float inDamping=0.0f)
Templated form of CalculateConstraintProperties with the motion types baked in.
Definition: AxisConstraintPart.h:76
void SaveState(StateRecorder &inStream) const
Save state of this constraint part.
Definition: AxisConstraintPart.h:384
void RestoreState(StateRecorder &inStream)
Restore state of this constraint part.
Definition: AxisConstraintPart.h:390
Definition: Body.h:33
EMotionType GetMotionType() const
Motion type of this body.
Definition: Body.h:82
bool IsDynamic() const
Check if this body is dynamic, which means that it moves and forces can act on it.
Definition: Body.h:56
void AddRotationStep(Vec3Arg inAngularVelocityTimesDeltaTime)
Update rotation using an Euler step (using during position integrate & constraint solving)
Definition: Body.inl:75
void SubPositionStep(Vec3Arg inLinearVelocityTimesDeltaTime)
Definition: Body.h:237
Mat44 GetInverseInertia() const
Get inverse inertia tensor in world space.
Definition: Body.inl:112
void SubRotationStep(Vec3Arg inAngularVelocityTimesDeltaTime)
Definition: Body.inl:93
const MotionProperties * GetMotionPropertiesUnchecked() const
Access to the motion properties (version that does not check if the object is kinematic or dynamic)
Definition: Body.h:209
void AddPositionStep(Vec3Arg inLinearVelocityTimesDeltaTime)
Update position using an Euler step (used during position integrate & constraint solving)
Definition: Body.h:236
Class that holds 3 floats. Used as a storage class. Convert to Vec3 for calculations.
Definition: Float3.h:13
Holds a 4x4 matrix of floats, but supports also operations on the 3x3 upper left part of the matrix.
Definition: Mat44.h:13
JPH_INLINE Vec3 Multiply3x3(Vec3Arg inV) const
Multiply vector by only 3x3 part of the matrix.
Definition: Mat44.inl:307
The Body class only keeps track of state for static bodies, the MotionProperties class keeps the addi...
Definition: MotionProperties.h:20
void AddLinearVelocityStep(Vec3Arg inLinearVelocityChange)
Definition: MotionProperties.h:126
Vec3 GetLinearVelocity() const
Get world space linear velocity of the center of mass.
Definition: MotionProperties.h:28
Vec3 GetAngularVelocity() const
Get world space angular velocity of the center of mass.
Definition: MotionProperties.h:37
void SubLinearVelocityStep(Vec3Arg inLinearVelocityChange)
Definition: MotionProperties.h:127
float GetInverseMass() const
Get inverse mass (1 / mass). Should only be called on a dynamic object (static or kinematic bodies ha...
Definition: MotionProperties.h:80
void SubAngularVelocityStep(Vec3Arg inAngularVelocityChange)
Definition: MotionProperties.h:129
void AddAngularVelocityStep(Vec3Arg inAngularVelocityChange)
Definition: MotionProperties.h:128
Class used in other constraint parts to calculate the required bias factor in the lagrange multiplier...
Definition: SpringPart.h:14
void CalculateSpringProperties(float inDeltaTime, float inInvEffectiveMass, float inBias, float inC, float inFrequency, float inDamping, float &outEffectiveMass)
Definition: SpringPart.h:25
float GetBias(float inTotalLambda) const
Get total bias b, including supplied bias and bias for spring: lambda = J v + b.
Definition: SpringPart.h:98
bool IsActive() const
Returns if this spring is active.
Definition: SpringPart.h:92
Definition: StateRecorder.h:15
void Read(T &outT)
Read a primitive (e.g. float, int, etc.) from the binary stream.
Definition: StreamIn.h:27
void Write(const T &inT)
Write a primitive (e.g. float, int, etc.) to the binary stream.
Definition: StreamOut.h:24
Definition: Vec3.h:16
JPH_INLINE float Dot(Vec3Arg inV2) const
Dot product.
Definition: Vec3.inl:637
JPH_INLINE Vec3 Cross(Vec3Arg inV2) const
Cross product.
Definition: Vec3.inl:582
JPH_INLINE bool IsNormalized(float inTolerance=1.0e-6f) const
Test if vector is normalized.
Definition: Vec3.inl:737
JPH_INLINE void StoreFloat3(Float3 *outV) const
Store 3 floats to memory.
Definition: Vec3.inl:757
static JPH_INLINE Vec3 sLoadFloat3Unsafe(const Float3 &inV)
Load 3 floats from memory (reads 32 bits extra which it doesn't use)
Definition: Vec3.inl:134
static JPH_INLINE Vec3 sNaN()
Vector with all NaN's.
Definition: Vec3.inl:129