The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

I am making a character in c++ and I want to have its camera's methods visible in the property inspector, like it would if I did this:

class Character : public Camera {
    OBJ_TYPE(Character, Camera)

I don't want my Character to inherent from Camera though (currently inherits from Spatial). Is there any way I could add something under void _bind_methods(), or void register_character_types() that could expose my camera to the inspector?

in Engine by (246 points)

Maybe just do get_camera?

I want these properties:

enter image description here
under a custom c++ node without inheriting from the Class Camera in my CustomCharacterClass, which would make my CustomCharacterNode a Camera as well, but instead make a c++ object of Class Camera like-> Camera CharacterCamera;. Is there a way to expose this c++ object of class Camera and its properties to the inspector?

I don't really have anything in them yet, but here is my current code for the header file:

#ifndef CHARACTERFPS_H
#define CHARACTERFPS_H

#include "scene/3d/visual_instance.h"
#include "scene/3d/camera.h"
#include "scene/3d/mesh_instance.h"

class CharacterFPS : public Spatial{
    OBJ_TYPE(CharacterFPS, Spatial)

protected:
    static void _bind_methods();

public:
    friend class Camera;

    Camera *FPS_Camera;
    MeshInstance *CharacterMesh;

    CharacterFPS();
    ~CharacterFPS();

private:

};

#endif

and my corresponding cpp file:

#include "CharacterFPS.h"


void CharacterFPS::_bind_methods() {

}

CharacterFPS::CharacterFPS() {

}

CharacterFPS::~CharacterFPS() {
    CharacterMesh->~MeshInstance();
    FPS_Camera->~Camera();
}

I plan to put everything I would need for future fps games in this custom node, so I don't have to copy and re-edit everything from project to project.

Iam very interested in your approach how you create
your FPS Controller in C++
Do you want to share some knowledge?
Please take a look to my question here in the Q&A-Forum:
http://godotengine.org/qa/3859/how-to-access-mouse-motion-input-from-_fixed_process
thank you in advance if you can help me

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.