steve3d Posted August 15, 2011 Share Posted August 15, 2011 I have a compass script, which have these codes: vec3 pos = imgSize * -s; mat4 trans = translate(pos) * scale(vec3(s)); compass.setLayerTransform(nPlateLayer, trans); you can see I'm using mat4 not dmat4, but engine keeps told me Variable::getMat4Safe(): can't convert dmat4 to mat4, why?? if I comment the setLayerTransform, then script runs, but of course, the compass WidgetSprite was placed with wrong position and scale. I've also checked the sample sprite.setLayerTransform(i + 1,translate(positions[i]) * scale(vec3(scales[i])) * rotate); It's really confusing me . :) Link to comment
ulf.schroeter Posted August 15, 2011 Share Posted August 15, 2011 try mat4 trans = mat4(translate()) * mat4(scale()) Link to comment
steve3d Posted August 16, 2011 Author Share Posted August 16, 2011 well, that's a very oddly trick. it works finally. :) why? Link to comment
ulf.schroeter Posted August 16, 2011 Share Posted August 16, 2011 Variable::getMat4Safe(): can't convert dmat4 to mat4 indicates that variable trans has actual type dmat4 (even if you declared it with mat4 hint, keep in mind its just a hint). Explicit casting to mat4 converts trans to the required input format for Sprite.setLayerTransform(mat4). Some previous operation seems to have caused an implicit type conversion to double format. Post your code before .... # give details on imgSize and s declaration and init .... vec3 pos = imgSize * -s; Link to comment
Recommended Posts