Fixed up functions
This commit is contained in:
parent
985dcf9691
commit
ee1dc530fa
|
@ -184,7 +184,7 @@ void API_Impl::UpdateWorld()
|
|||
simpleBody->GetMotionState()->getWorldTransform(trans);
|
||||
this->customBodies[i]->SetPosition(Float3(trans.getOrigin().x(), trans.getOrigin().y(), trans.getOrigin().z()));
|
||||
this->customBodies[i]->SetRotation(Quaternion(Float3(trans.getRotation().x(), trans.getRotation().y(), trans.getRotation().z()), trans.getRotation().w()));
|
||||
|
||||
//simpleBody->SetUpAndRight(Float3(0,1,0), Float3(-1,0,0));
|
||||
if(simpleBody->GetRigidBody()->getActivationState() == ACTIVE_TAG)
|
||||
{
|
||||
simpleBody->CallSubscription_Move();
|
||||
|
|
|
@ -141,40 +141,40 @@ void SimpleRigidBody::SetAngularFactor(Float factor)
|
|||
|
||||
void SimpleRigidBody::SetUpAndRight(::Oyster::Math::Float3 up, ::Oyster::Math::Float3 right)
|
||||
{
|
||||
btTransform trans;
|
||||
btMatrix3x3 rotation;
|
||||
btVector3 upVector(up.x, up.y, up.z);
|
||||
btVector3 rightVector(right.x, right.y, right.z);
|
||||
rotation[1] = upVector.normalized();
|
||||
rotation[0] = rightVector.normalized();
|
||||
rotation[2] = upVector.cross(rightVector).normalized();
|
||||
rotation[2] = rightVector.cross(upVector).normalized();
|
||||
|
||||
this->motionState->getWorldTransform(trans);
|
||||
trans.setBasis(rotation);
|
||||
this->motionState->setWorldTransform(trans);
|
||||
|
||||
btQuaternion quaternion;
|
||||
rotation.getRotation(quaternion);
|
||||
quaternion = trans.getRotation();
|
||||
this->state.quaternion = Quaternion(Float3(quaternion.x(), quaternion.y(), quaternion.z()), quaternion.w());
|
||||
|
||||
btTransform trans;
|
||||
this->motionState->getWorldTransform(trans);
|
||||
trans.setRotation(quaternion);
|
||||
this->motionState->setWorldTransform(trans);
|
||||
}
|
||||
|
||||
void SimpleRigidBody::SetUpAndForward(::Oyster::Math::Float3 up, ::Oyster::Math::Float3 forward)
|
||||
{
|
||||
btTransform trans;
|
||||
btMatrix3x3 rotation;
|
||||
btVector3 upVector(up.x, up.y, up.z);
|
||||
btVector3 forwardVector(forward.x, forward.y, forward.z);
|
||||
rotation[1] = upVector.normalized();
|
||||
rotation[0] = forwardVector.normalized();
|
||||
rotation[2] = upVector.cross(forwardVector).normalized();
|
||||
rotation[2] = forwardVector.normalized();
|
||||
rotation[0] = forwardVector.cross(upVector).normalized();
|
||||
|
||||
this->motionState->getWorldTransform(trans);
|
||||
trans.setBasis(rotation);
|
||||
this->motionState->setWorldTransform(trans);
|
||||
|
||||
btQuaternion quaternion;
|
||||
rotation.getRotation(quaternion);
|
||||
quaternion = trans.getRotation();
|
||||
this->state.quaternion = Quaternion(Float3(quaternion.x(), quaternion.y(), quaternion.z()), quaternion.w());
|
||||
|
||||
btTransform trans;
|
||||
this->motionState->getWorldTransform(trans);
|
||||
trans.setRotation(quaternion);
|
||||
this->motionState->setWorldTransform(trans);
|
||||
}
|
||||
|
||||
Float4x4 SimpleRigidBody::GetRotation() const
|
||||
|
|
Loading…
Reference in New Issue