1. Home
  2. /
  3. Ogre3d
  4. /
  5. Camera Orbit Example

Camera Orbit Example - Ogre3d Typing CST Test

Loading…

Camera Orbit Example — Ogre3d Code

Orbits the camera around an entity.

#include <Ogre.h>
using namespace Ogre;

int main() {
	Root* root = new Root();
	root->restoreConfig();
	RenderWindow* window = root->initialise(true, "Ogre3D Orbit");

	SceneManager* sceneMgr = root->createSceneManager(ST_GENERIC);
	Entity* entity = sceneMgr->createEntity("ogrehead.mesh");
	SceneNode* node = sceneMgr->getRootSceneNode()->createChildSceneNode();
	node->attachObject(entity);

	Camera* camera = sceneMgr->createCamera("MainCam");
	Viewport* vp = window->addViewport(camera);

	float angle = 0.0f;
	while(true) {
		angle += 0.01f;
		camera->setPosition(Vector3(200*std::cos(angle),50,200*std::sin(angle)));
		camera->lookAt(Vector3(0,0,0));
		root->renderOneFrame();
	}

	delete root;
	return 0;
}

Ogre3d Language Guide

OGRE (Object-Oriented Graphics Rendering Engine) is an open-source, high-performance 3D graphics rendering engine written in C++, focusing on flexibility, modularity, and real-time 3D rendering for games and simulations.

Primary Use Cases

  • ▸3D game development with custom engines
  • ▸Simulations and VR/AR projects
  • ▸Educational graphics projects
  • ▸3D visualization for scientific/engineering applications
  • ▸Rapid prototyping of rendering features

Notable Features

  • ▸Scene graph architecture
  • ▸Material and shader system
  • ▸Mesh and skeletal animation support
  • ▸Particle systems for effects
  • ▸Multiple render system backends (OpenGL, Direct3D)

Origin & Creator

OGRE3D was originally developed by Steve Streeting in 2001, designed to simplify 3D graphics development while providing full control over rendering pipelines.

Industrial Note

OGRE3D is used in indie and research projects, simulations, virtual reality prototypes, and educational environments where a custom 3D rendering engine is needed without building from scratch.

More Ogre3d Typing Exercises

Ogre3D Minimal Scene ExampleOgre3D Skybox ExampleOgre3D Light ExampleOgre3D Animating Entity ExampleOgre3D Terrain ExampleOgre3D Particle System ExampleOgre3D Shadow ExampleOgre3D Multiple Entities Example

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher