Game Development Community

Some trouble with advanced camera

by University of Central FL (#0003) · in Torque Game Engine · 07/29/2006 (12:53 pm) · 0 replies

I am trying to get camera shaking working in the orbitcam mode. I wrote my own function in player.cpp that looks like this:
void Player::shakeCamera()
{
    CameraShake *groundImpactShake = new CameraShake;
    groundImpactShake->setDuration( mDataBlock->groundImpactShakeDuration );
    groundImpactShake->setFrequency( mDataBlock->groundImpactShakeFreq );

    VectorF shakeAmp = mDataBlock->groundImpactShakeAmp ; //* ampScale;
    groundImpactShake->setAmplitude( shakeAmp );
    groundImpactShake->setFalloff( mDataBlock->groundImpactShakeFalloff );
    groundImpactShake->init();
    gCamFXMgr.addFX( groundImpactShake );
}

// shakes the camera
ConsoleMethod(Player,shakeCamera, void, 2, 2,"()Shakes the camera.")
{
   object->shakeCamera();
}


Whenever I do %player.shakeCamera() from the console, the camera does shake, but it only works in first person mode.

Anyone know how to get this to work in orbitcam?