AndEngine 中 SVG 超出精灵范围
我在 andengine 中使用 SVG 扩展。
这就是我加载 svg 纹理的方式,
this.hugoRegion = SVGBitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.hugoBuildableTextureAtlas, this, "Hugo_Sprite.svg",Width,Height,Columns, Rows);
如您所见,我有平铺区域。
一切工作正常,直到我将使用 svg 的玩家精灵附加到场景并将精灵扩展到图像之外。如果它与另一个精灵碰撞,它会在距离精灵身体一米的地方碰撞。
例如她是一个精灵,其中红色框表示精灵延伸的距离。我希望它完全包裹在图像周围。
有人遇到过这个问题吗?
I am using SVG extension in andengine.
This is how i load in my svg textures
this.hugoRegion = SVGBitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.hugoBuildableTextureAtlas, this, "Hugo_Sprite.svg",Width,Height,Columns, Rows);
As you see i have the the tiled region.
Everything works fine until i attach the player sprite that uses the svg to the scene and it extends the sprite beyond the image. If it collides with another sprite it collides like a meter away from the sprite's body.
For example her is a sprite, where the red box is thats how far the sprite is extended. I want it to WRAP exactly around the image..
Anyone ever ran into this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这是不可能的....您需要创建 svg,使其包装精灵,以编程方式很难实现...
第二种方法是,如果您不想重新创建 svg,那么,我想在你的类中创建一个扩展精灵的矩形,保持矩形尺寸以便它包裹精灵,然后用矩形而不是整个 svg 实现与函数的碰撞。
I dont think that would be possible .... you need to create the svg such that it wraps the sprite, programmically that would be tough to achieve...
2nd way would be, if you dont want to re-create the svg then, i guess create a rectangle in your class which extends sprite, keep the rectangle dimensions such that it wraps the sprite and then implement the collides with function with the rectangle instead of whole svg.