I initially wanted to have this post deleted, but after Thaumaturge left a comment, I realized that even if I had truely found a solution, it may not be the most efficient one.
Essentially, I’m trying to create a custom class that inherits from ActorNode that; upon construction and destruction; properly manages it’s own associated collision Solids and Nodes.
It’s worth noting that aside from the fact that this is my first foray into the c++ side of panda3d, I’m also fairly inexperienced with c++, so I worry that I might be overlooking something simple.
That being said, this is what I have so far:
#pragma once
#ifndef PLAYERENTITYBASE
#define PLAYERENTITYBASE
#include "actorNode.h"
#include "collisionBox.h"
#include "collisionNode.h"
class playerEntBase : public ActorNode
{
};
playerEntBase::playerEntBase()
{
CollisionNode boxNode("collisionBumpHolder");
PT(CollisionBox) hitbox = new CollisionBox(const LPoint3(0, 0, 0),PN_stdfloat(6),PN_stdfloat(6),PN_stdfloat(9.75));
boxNode.add_solid(hitbox);
this->add_child(boxNode);
};
#endif
The part I’m struggling with is this->add_child(boxnode), where I’m given an error ‘No suitable conversion from “CollisionNode” to “PandaNode” exists’.
On top of being generally confused, I’m now worried Visual Studio is going to yell at me when I try to build.
To try and summarize my question, What’s the best way of attaching “sub-nodes” in C++? Should I be concerned about errors involving classes that inherit from the classes that are accepted?
Edit: fixed code in post to reflect fix I made literally just after rewriting this post