framework2

Форк
0

..
/
ofxFirstPersonCamera 
6 месяцев назад
6 месяцев назад
6 месяцев назад
README.md

ofxFirstPersonCamera

Lightweight ofCamera class that replicates camera controls of first person video games. It uses mouse to look around, hides cursor on activation and has reassignable keys which by default set to WASD for moving the camera, E and C to move camera up and down, Q and R to roll left and right and F to reset camera's up vector.

Tested on Linux and Windows, should work on Mac as well.

Dependencies

1. OF 0.9.0 and C++11

Compiling

For openFrameworks:

See wiki

For CMake-based openFrameworks:

Add this repo as a git submodule to your ofApp folder and use ofxaddon command in CMakeLists.txt.

How to use

Include header file in ofApp.h, add an instance of ofxFirstPersonCamera:

#pragma once
#include "ofMain.h"
#include "ofxFirstPersonCamera.h"
class ofApp : public ofBaseApp
{
public:
void mousePressed(ofMouseEventArgs &mouse);
void draw();
ofxFirstPersonCamera cam;
};

Enable first person camera control in setup call and set computed matrix to any ofCamera:

#include "ofApp.h"
void ofApp::mousePressed(ofMouseEventArgs &mouse)
{
cam.toggleControl();
}
void ofApp::draw()
{
cam.begin();
ofDrawGrid(10.0f, 10, true);
cam.end();
}

Examples

example-ofxFirstPersonCamera

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.