Return the local inertia tensor of the collision shape * @param mass Mass to use to compute the inertia tensor of the collision shape */
| 51 | * @param mass Mass to use to compute the inertia tensor of the collision shape |
| 52 | */ |
| 53 | Vector3 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 |
| 62 | bool BoxShape::raycast(const Ray& ray, RaycastInfo& raycastInfo, Collider* collider, MemoryAllocator& /*allocator*/) const { |