예제 #1
0
void CCS::FreeCameraMode::update(const Ogre::Real &timeSinceLastFrame)
{
    Ogre::Vector3 dirVector = mCameraCS->getOgreCamera()->getRealDirection();
    Ogre::Vector3 lateralVector = dirVector.crossProduct(mFixedAxis).normalisedCopy();
    Ogre::Vector3 upVector = -dirVector.crossProduct(lateralVector).normalisedCopy();

    Ogre::Vector3 displacement = ((dirVector * mLongitudinalDisplacement)
        + (upVector * mVerticalDisplacement)
        + (lateralVector * mLateralDisplacement)) * timeSinceLastFrame * mMoveFactor;

    mCameraPosition += displacement;

    if(mCollisionsEnabled)
    {
        mCameraPosition = collisionDelegate(mCameraCS->getCameraTargetPosition(), mCameraPosition);
    }

    Ogre::Quaternion offsetX(mRotY,Ogre::Vector3::UNIT_X);
    Ogre::Quaternion offsetY(mRotX,mFixedAxis);

	mCameraOrientation = offsetY * offsetX;

    mLongitudinalDisplacement = 0;
    mLateralDisplacement = 0;
    mVerticalDisplacement = 0;            
}
예제 #2
0
void CCS::OrbitalCameraMode::update(const Ogre::Real &timeSinceLastFrame)
{
    ChaseFreeYawAxisCameraMode::update(timeSinceLastFrame);

    mRotVertical += mRotVerticalDisplacement * timeSinceLastFrame * mRotationFactor;
    mRotHorizontal += mRotHorizontalDisplacement * timeSinceLastFrame * mRotationFactor;
    mZoom += mZoomDisplacement * timeSinceLastFrame * mZoomFactor;

    Ogre::Quaternion offsetVertical(mRotVertical,Ogre::Vector3::UNIT_X);
    Ogre::Quaternion offsetHorizontal(mRotHorizontal,Ogre::Vector3::UNIT_Y);

    mCameraOrientation = mCameraOrientation * offsetHorizontal * offsetVertical;
    mCameraPosition += mCameraOrientation * Ogre::Vector3(0,0,mZoom);

    mRotVerticalDisplacement = 0;
    mRotHorizontalDisplacement = 0;
    mZoomDisplacement = 0;

    if(mCollisionsEnabled)
    {
        mCameraPosition = collisionDelegate(mCameraCS->getCameraTargetPosition(), mCameraPosition);
    }
}
void CCS::CollidableOrbitalCameraMode::update(const Ogre::Real &timeSinceLastFrame)
{
	OrbitalCameraMode::update(timeSinceLastFrame);

	mCameraPosition = collisionDelegate(mCameraCS->getCameraTargetPosition(), mCameraPosition);
}