MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / getLocalInertiaTensor

Method getLocalInertiaTensor

src/collision/shapes/BoxShape.cpp:53–59  ·  view source on GitHub ↗

Return the local inertia tensor of the collision shape * @param mass Mass to use to compute the inertia tensor of the collision shape */

Source from the content-addressed store, hash-verified

51 * @param mass Mass to use to compute the inertia tensor of the collision shape
52 */
53Vector3 BoxShape::getLocalInertiaTensor(decimal mass) const {
54 const decimal factor = (decimal(1.0) / decimal(3.0)) * mass;
55 const decimal xSquare = mHalfExtents.x * mHalfExtents.x;
56 const decimal ySquare = mHalfExtents.y * mHalfExtents.y;
57 const decimal zSquare = mHalfExtents.z * mHalfExtents.z;
58 return Vector3(factor * (ySquare + zSquare), factor * (xSquare + zSquare), factor * (xSquare + ySquare));
59}
60
61// Raycast method with feedback information
62bool BoxShape::raycast(const Ray& ray, RaycastInfo& raycastInfo, Collider* collider, MemoryAllocator& /*allocator*/) const {

Callers 5

testGettersSettersMethod · 0.45
setTypeMethod · 0.45
RigidBody.cppFile · 0.45

Calls 1

Vector3Class · 0.50

Tested by 2

testGettersSettersMethod · 0.36