Revert "add a testing camera fps (switching cameras by pressing t)"

This reverts commit 4707d85150.
This commit is contained in:
2024-08-13 17:40:57 +02:00
parent 3426532a65
commit 311675de07
4 changed files with 56 additions and 82 deletions

View File

@@ -28,8 +28,6 @@ SpringArmPivot::~SpringArmPivot() {}
void SpringArmPivot::_ready() {
m_SpringArm = Object::cast_to<godot::SpringArm3D>(get_child(0));
m_Camera = Object::cast_to<godot::Camera3D>(m_SpringArm->get_child(0));
m_CameraFPS = get_parent()->get_node<godot::Camera3D>("Mesh/Armature/Skeleton3D/BoneAttachment3D/CameraFPS");
DEV_ASSERT(m_SpringArm);
DEV_ASSERT(m_Camera);
if (!godot::Engine::get_singleton()->is_editor_hint()) {
@@ -42,22 +40,11 @@ void SpringArmPivot::_unhandled_input(const godot::Ref<godot::InputEvent>& p_eve
if (event) {
rotate_y(-event->get_relative().x * 0.005);
m_SpringArm->rotate_x(-event->get_relative().y * 0.005);
m_CameraFPS->rotate_x(event->get_relative().y * 0.005);
godot::Vector3 rotationClamped = m_SpringArm->get_rotation();
rotationClamped.x = godot::UtilityFunctions::clamp(rotationClamped.x, -Math_PI / 4, Math_PI / 4);
m_SpringArm->set_rotation(rotationClamped);
}
auto* keyboardevent = Object::cast_to<godot::InputEvent>(p_event.ptr());
if (keyboardevent->is_action_pressed("switch_camera")) {
if (m_Camera->is_current()) {
m_Camera->clear_current();
} else {
m_Camera->make_current();
}
}
}
void SpringArmPivot::_physics_process(float delta) {

View File

@@ -1,9 +1,9 @@
#pragma once
#include <godot_cpp/classes/camera3d.hpp>
#include <godot_cpp/classes/input_event.hpp>
#include <godot_cpp/classes/node3d.hpp>
#include <godot_cpp/classes/spring_arm3d.hpp>
#include <godot_cpp/classes/camera3d.hpp>
namespace blitz {
class SpringArmPivot : public godot::Node3D {
@@ -32,7 +32,6 @@ class SpringArmPivot : public godot::Node3D {
private:
godot::SpringArm3D* m_SpringArm;
godot::Camera3D* m_Camera;
godot::Camera3D* m_CameraFPS;
bool m_DynamicFOV = false;
};