MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / createCamera

Method createCamera

src/engine/World.cpp:1045–1068  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1043}
1044
1045Handle::EntityHandle WorldInstance::createCamera()
1046{
1047 // Add player-camera
1048 m_Camera = addEntity(Components::PositionComponent::MASK);
1049
1050 Math::Matrix lookAt = Math::Matrix::CreateLookAt(Math::float3(0, 0, 0), Math::float3(1, 0, 0), Math::float3(0, 1, 0));
1051 getCameraComp<Components::PositionComponent>().m_WorldMatrix = lookAt.Invert();
1052
1053 getCameraComp<Components::PositionComponent>().m_WorldMatrix.Translation(Math::float3(0.0f, 50.0f, 50.0f));
1054
1055 Components::LogicComponent& logic = Components::Actions::initComponent<Components::LogicComponent>(
1056 getComponentAllocator(),
1057 m_Camera);
1058
1059 Logic::CameraController* cam = new Logic::CameraController(*this, m_Camera);
1060 logic.m_pLogicController = cam;
1061
1062 LogInfo() << "Setting camera mode to third-person";
1063 cam->setCameraMode(Logic::CameraController::ECameraMode::ThirdPerson);
1064 //cam->getCameraSettings().freeCameraSettings.moveSpeed = 5.0f;
1065 //cam->getCameraSettings().freeCameraSettings.turnSpeed = 3.5f;
1066
1067 return m_Camera;
1068}
1069
1070Handle::EntityHandle WorldInstance::getCamera()
1071{

Callers 1

onWorldCreatedMethod · 0.80

Calls 3

InvertMethod · 0.80
TranslationMethod · 0.80
setCameraModeMethod · 0.80

Tested by

no test coverage detected