- تم التحرير
Bounding Boxes with incorrect size on runtime
I'm currently using Spine to create cutscenes, and I have a bounding box to represent the visible part of the scene, so I can properly scale and position the skeleton according to the user's screen size.
The problem is this bounding box has a different size in runtime than how I set it in Spine itself. I also used Skeleton Viewer to be sure the exported JSON was OK. Check the images below:
Scene in Spine: Image removed due to the lack of support for HTTPS. | Show Anyway
Scene in Skeleton Viewer: Image removed due to the lack of support for HTTPS. | Show Anyway
Scene in the game: Image removed due to the lack of support for HTTPS. | Show Anyway
The bounding box in the game was rendered by using SkeletonRenderedDebug.
I'm using the latest version of Spine (2.1.27 Essential) along with the LibGDX runtime from Github, up to commit aa4a8d0 (Fixed setup pose slot blend mode.).
Thanks for the attention.
I don't think it is just bounding boxes, I think it is meshes in general.
I have a frame for a window, and if it was drawn to size it would be the biggest part of the texture with the smallest detail, so the 'solution' was to chop the detail-less middle parts of the frame (leaving curved corners in tact). Then make the image a mesh and add strategic verts so we could stretch the frame to fit the window. However in game, it doesn't match as it does in spine
Both meshes and bounding boxes should be the same at runtime as they are in Spine. Game toolkits handle rendering differently, so there could be a bug in that part of the runtime. Since you are using spine-libgdx which Spine also uses, it should show correctly. Are you sure your SkeletonRendererDebug ShapeRenderer has the same projection matrix as your Batch? Depending how you set the projection matrix, you may need to call ShapeRenderer updateMatrices
afterward.
Thanks for the reply Nate, manually updating the SkeletonRendererDebug's ShapeRenderer matrices fixed the offset and made me realize what was wrong in my code, the camera wasn't being properly updated. Silly mistake haha