void Triggerable::setDecalType(std::string decalType_) { this->decalType = decalType_; GameObject* gameObjectRef = (GameObject*)this->GetObject(); ASSERT(gameObjectRef->GetClassType() & CLASS_TYPE_GAMEOBJECT, "Object is a game object"); this->decalRef = DecalGenerator::GetDecalFromDecalType(this->decalType, gameObjectRef->GetParentSceneGraph()); gameObjectRef->AddChild(this->decalRef->GetId()); }
void GameObject::AddChild_maintainTransform(ObjectIdType childId) { GameObject* child = (GameObject*)ObjectRegistry::GetObjectById(childId); if (child != nullptr) { ASSERT(child->GetClassType() & CLASS_TYPE_GAMEOBJECT, "Child is a game object"); glm::mat4 oldModelMatrixCumulative = child->GetTransform()->GetModelMatrixCumulative(); Object::AddChild(childId); child->GetTransform()->SetModelMatrixCumulative(oldModelMatrixCumulative); } else { ASSERT(0, "Child found"); } }