Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I'm trying to use 2D overlays for a kind of health bar, and to scale it dynamically. However, ccbSetSceneNodeProperty(node, "Height (percent)", percentage); does nothing. Am I doing something wrong? (webgl target) |
||||
|
yeah, the webGL target somehow doesn't support the relative (Percent) based scale and position method for overlays. You can still use the Pixel based scaling and height adjusting. It won't be hard to create your own percentage based scaling with canvas height and width by calculating it with the pixels based values. so if you use something like this
then it should just work fine and will scale your 2D overlay. |
||||
|
Thanks, just_in_case! I just figured that out too. "Height (pixels)" works, "Height (percent)" doesn't. Despite the latter appearing in copperlicht.js. But yes, initial position and scale is by percent, based on node attributes in the editor. Then I can simply read the pixels to see how much that'd be for eg. 50% of the screen height. It won't support resolution changes while playing, but that's acceptable. |
|