Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
MassProperties.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
8
10
11class StreamIn;
12class StreamOut;
13
16{
17public:
19
20
25 bool DecomposePrincipalMomentsOfInertia(Mat44 &outRotation, Vec3 &outDiagonal) const;
26
28 void SetMassAndInertiaOfSolidBox(Vec3Arg inBoxSize, float inDensity);
29
31 void ScaleToMass(float inMass);
32
34 static Vec3 sGetEquivalentSolidBoxSize(float inMass, Vec3Arg inInertiaDiagonal);
35
37 void Rotate(Mat44Arg inRotation);
38
40 void Translate(Vec3Arg inTranslation);
41
43 void Scale(Vec3Arg inScale);
44
46 void SaveBinaryState(StreamOut &inStream) const;
47
49 void RestoreBinaryState(StreamIn &inStream);
50
52 float mMass = 0.0f;
53
55 Mat44 mInertia = Mat44::sZero();
56};
57
#define JPH_EXPORT
Definition: Core.h:236
#define JPH_NAMESPACE_END
Definition: Core.h:378
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:372
#define JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(linkage, class_name)
Definition: SerializableObject.h:80
Describes the mass and inertia properties of a body. Used during body construction only.
Definition: MassProperties.h:16
Holds a 4x4 matrix of floats, but supports also operations on the 3x3 upper left part of the matrix.
Definition: Mat44.h:13
static JPH_INLINE Mat44 sZero()
Zero matrix.
Definition: Mat44.inl:30
Simple binary input stream.
Definition: StreamIn.h:13
Simple binary output stream.
Definition: StreamOut.h:13
Definition: Vec3.h:17