Java Code Examples for com.jme3.bullet.collision.shapes.CollisionShape#calculateLocalInertia()
The following examples show how to use
com.jme3.bullet.collision.shapes.CollisionShape#calculateLocalInertia() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PhysicsRigidBody.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void setCollisionShape(CollisionShape collisionShape) { super.setCollisionShape(collisionShape); if(collisionShape instanceof MeshCollisionShape && mass!=0){ throw new IllegalStateException("Dynamic rigidbody can not have mesh collision shape!"); } if (rBody == null) { rebuildRigidBody(); } else { collisionShape.calculateLocalInertia(mass, localInertia); constructionInfo.collisionShape = collisionShape.getCShape(); rBody.setCollisionShape(collisionShape.getCShape()); } }
Example 2
Source File: PhysicsRigidBody.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void setCollisionShape(CollisionShape collisionShape) { super.setCollisionShape(collisionShape); if(collisionShape instanceof MeshCollisionShape && mass!=0){ throw new IllegalStateException("Dynamic rigidbody can not have mesh collision shape!"); } if (rBody == null) { rebuildRigidBody(); } else { collisionShape.calculateLocalInertia(mass, localInertia); constructionInfo.collisionShape = collisionShape.getCShape(); rBody.setCollisionShape(collisionShape.getCShape()); } }