My custom node is based on a billboard. The render function does the following :
Code: Select all
/**
* @brief Irrlicht's overload render() - Renders this object.
*/
void render()
{
video::IVideoDriver* driver = SceneManager->getVideoDriver();
if(driver != nullptr)
{
driver->setMaterial(_Material);
// render all
core::matrix4 mat = getAbsoluteTransformation();
vector3df position = getAbsolutePosition();
position.X += (getSize().Width / 2);
position.Y -= (getSize().Height / 2);
mat.setTranslation(position);
driver->setTransform(video::ETS_WORLD, mat);
driver->drawIndexedTriangleList(_Vertices, 4, _Indices, 2);
driver->setTransform(video::ETS_WORLD, irr::core::IdentityMatrix);
}
}
I tried to override the setRotation() function by doing the following :
Code: Select all
void setRotation(const vector3df & rotation)
{
vector3df oldPos = getPosition();
setPosition(vector3df(oldPos.X + getPivotPoint().X, oldPos.Y + getPivotPoint().Y, oldPos.Z));
BaseClass::setRotation(rotation);
setPosition(oldPos);
I suspect that my rendering code, and particularly the fact that I compute the matrix each time, is responsible for that. Or I may have understood the concept poorly.
Can someone point me in the right direction? How should I rotate my custom node using a custom pivot point?
Thanks!