Jump to content

[SOLVED] pivot point, transform layer in widgetSprite


photo

Recommended Posts

Hi all. 

I have widgetSprite. I added the layer. Using WidgetSprite::setLayerTransform I rotate it.

sprite_env_but.setLayerTransform(1, rotateZ(30.0f*sl_environment.getValue()));

 

But it takes a pivot point in the upper left corner. How to rotate around its center?

Thanks.

Link to comment

Try providing combined trans-rot-inverse-trans-matrix e.g. translate( vec3( 0.5f, 0.5f, 0.0f ) ) * rotateZ() * translate( vec3( -0.5f, -0.5f, 0.0f ) )

Link to comment
×
×
  • Create New...