If I create an object: for example a sphere of a certain material can I know its weight? Can I know the specific weight of a material among those I can choose in Reality Composer? Thank you to those who can help me.
Reality Composer
You can compute it:
- if the sphere is full, the weight is Volume * specific weight, where Volume = 4/3 * pi * RRR
- if sphere is empty with d thickness (d smal compared to R): weight is Surface * d * specific weight, where Surface = 4* pi * R*R
You can find specific weight in many places on Internet.
Assuming you set up a physics body for your entity in Reality Composer, you can actually directly get the mass of the physics body:
// Load the scene from your .rcproject.
let sceneAnchor = try! MyRealityComposerProject.loadScene()
// Get a reference to the entity that you configured a physics body for.
let box = sceneAnchor.box
// Get the physics body from the entity's component set.
guard let physicsBody = box?.components[PhysicsBodyComponent.self] as? PhysicsBodyComponent else {
fatalError("box has no PhysicsBodyComponent.")
}
// Access the mass properties of the physics body.
print(physicsBody.massProperties.mass)