Skip to content

Instantly share code, notes, and snippets.

@ZachMassia
Created December 7, 2013 21:33
Show Gist options
  • Save ZachMassia/7849065 to your computer and use it in GitHub Desktop.
Save ZachMassia/7849065 to your computer and use it in GitHub Desktop.
// An alternative to this method is to use a small hierarchy of
// nodes with the camera being attached to the deepest child node.
// With this alternative method, you would not have to manually place
// and rotate your spotlight. It also avoids gimbal lock.
//
// Here is where I got most of the code for my FPS setup for lab 4:
// http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Creating+a+simple+first-person+camera+system
void yourUpdateFunc()
{
// Ray cast in camera look direction.
Ogre::Ray r;
r.setDirection(mCamera->getDirection());
r.setOrigin(mCamera->getPosition());
// You could also set your spotlight direction to the ray direction,
// and the spotlight position to the ray position.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment