waechtertroll Posted January 31, 2018 Share Posted January 31, 2018 Hello, although I don't have enough spare time to create games at the moment, I'm playing a bit around with code to understand game mechanics. At the moment I'm teaching myself soft body dynamics. I can create an entity consisting just of cordinates (say a sphere) and play around with their shape, wobbling, squishing etc. But I'm at a loss at how to bind a texture to them that actually distorts according to the coord changes; preferrably in a way performant enough to use it in a game, and most preferrably done in Pixijs. Maybe I'll have to cut the texture into a mesh, bind UV coordinates to them and then use something like three.js to render it? I see that e.g. Dragonbone has some way to add meshes to characters - plus it can be used from pixi. Will it distort textures properly when I modify mesh coordinates, or is this information only used when exporting animations? What other approaches can you think of? Quote Link to comment Share on other sites More sharing options...
Christoph Posted February 1, 2018 Share Posted February 1, 2018 If your sphere consists of some kind of geometry with uv mapped textures, distorting the geometry should as well distort the displayed texture. According to the API of PIXI http://pixijs.download/release/docs/PIXI.mesh.Mesh.html: You should (for example) specify both vertices and their UV coordinates, if you want to have this performant you need to distort the verticies in your vertex shader as well: http://pixijs.download/release/docs/PIXI.Shader.html Please note that I have not tried this. Quote Link to comment Share on other sites More sharing options...
waechtertroll Posted February 5, 2018 Author Share Posted February 5, 2018 Thanks... the Mesh class seems to do exactly what I think I need. Documentation could be a bit better. I'll have to play around a bit with dividing stuff into proper coordinates and figuring out how Mesh uses them exactly, but I'll give it a try in the next weeks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.