mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-22 10:22:52 +01:00
Fix camera angles being outta whack
This commit is contained in:
parent
052ce629c4
commit
7acec24597
@ -67,15 +67,19 @@ void IngameState::tick(float dt)
|
|||||||
|
|
||||||
float viewDistance = _playerCharacter->getCurrentVehicle() ? -3.5f : -2.5f;
|
float viewDistance = _playerCharacter->getCurrentVehicle() ? -3.5f : -2.5f;
|
||||||
|
|
||||||
glm::vec3 localView{0.f, -viewDistance, 1.f};
|
glm::vec3 localview;
|
||||||
localView = vR * localView;
|
float vy = cos(_lookAngles.y);
|
||||||
|
localview.x = -sin(-_lookAngles.x) * vy;
|
||||||
|
localview.y = -cos(-_lookAngles.x) * vy;
|
||||||
|
localview.z = -sin(_lookAngles.y);
|
||||||
|
localview *= viewDistance;
|
||||||
|
|
||||||
glm::vec3 viewPos = _playerCharacter->getPosition();
|
glm::vec3 viewPos = _playerCharacter->getPosition();
|
||||||
if(_playerCharacter->getCurrentVehicle()) {
|
if(_playerCharacter->getCurrentVehicle()) {
|
||||||
viewPos = _playerCharacter->getCurrentVehicle()->getPosition();
|
viewPos = _playerCharacter->getCurrentVehicle()->getPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
setViewParameters( viewPos + localView, _lookAngles );
|
setViewParameters( viewPos + localview, _lookAngles );
|
||||||
}
|
}
|
||||||
|
|
||||||
void IngameState::handleEvent(const sf::Event &event)
|
void IngameState::handleEvent(const sf::Event &event)
|
||||||
|
Loading…
Reference in New Issue
Block a user