|
@@ -237,18 +237,20 @@ void PhysicsSceneEntity::setVelocity(Vector3 velocity) {
|
|
|
// rigidBody->applyForce(btVector3(velocity.x, velocity.y, velocity.z), btVector3(0,0,0));
|
|
// rigidBody->applyForce(btVector3(velocity.x, velocity.y, velocity.z), btVector3(0,0,0));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void PhysicsSceneEntity::warpTo(Vector3 position) {
|
|
|
|
|
|
|
+void PhysicsSceneEntity::warpTo(Vector3 position, bool resetRotation) {
|
|
|
btTransform transform;
|
|
btTransform transform;
|
|
|
|
|
+ transform.setIdentity();
|
|
|
|
|
|
|
|
- Matrix4 ent_mat = sceneEntity->getConcatenatedMatrix();
|
|
|
|
|
|
|
+ if(!resetRotation) {
|
|
|
|
|
+ Matrix4 ent_mat = sceneEntity->getConcatenatedMatrix();
|
|
|
|
|
+ btScalar mat[16];
|
|
|
|
|
+ for(int i=0; i < 16; i++) {
|
|
|
|
|
+ mat[i] = ent_mat.ml[i];
|
|
|
|
|
+ }
|
|
|
|
|
+ transform.setFromOpenGLMatrix(mat);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- btScalar mat[16];
|
|
|
|
|
- for(int i=0; i < 16; i++) {
|
|
|
|
|
- mat[i] = ent_mat.ml[i];
|
|
|
|
|
- }
|
|
|
|
|
- transform.setFromOpenGLMatrix(mat);
|
|
|
|
|
transform.setOrigin(btVector3(position.x,position.y,position.z));
|
|
transform.setOrigin(btVector3(position.x,position.y,position.z));
|
|
|
-
|
|
|
|
|
rigidBody->setCenterOfMassTransform(transform);
|
|
rigidBody->setCenterOfMassTransform(transform);
|
|
|
}
|
|
}
|
|
|
|
|
|