I created a GameObject class in which I have 2 constructors. One default GameObject () = default; but in which at me in sheet of initializations variables are initialized. And in the second constructor GameObject(vec3 pos, vec3 rot, vec3 scale), and I want to add a default constructor in the init list so that it has the same parameters. But I need to modify some variables a bit, for example transform(Transformation((*this)) to transform(Transformation((*this), position, rotation, scale). But I can't do it because I'm have a error "a delegated constructor cannot have other map-initialization".
This a template code:
class GameObject
{
//params .....
GameObject::GameObject()
: transform(Transformation((*this))), render(true)
{
}
GameObject::GameObject(glm::vec3 position, glm::vec3 rotation, glm::vec3 scale)
: GameObject(),
transform(Transformation((*this), position, rotation, scale) //here a error
{
}
}
How can I fix that? Or maybe C++ have another way to do that?
Aucun commentaire:
Enregistrer un commentaire