C++ Class Inheritance/Property Inspector

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By SupToasty
:warning: Old Version Published before Godot 3 was released.

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?

Maybe just do get_camera?

Bojidar Marinov | 2016-05-14 17:39

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.

SupToasty | 2016-05-14 18:11

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:
How To Access Mouse-Motion-Input From [_fixed_process] ? - Archive - Godot Forum
thank you in advance if you can help me

Rxel | 2016-05-16 11:05