Futile
Futile copied to clipboard
Integrate physics with Futile
Integrate with the built-in Unity physics engine. Create a separate physics library/engine/thing to do this so that it doesn't overcomplicate the normal Futile stuff. It'll probably be stored as a separate github project.
I have tried to add game objects in back of the FSprites for the collisions, but the edges of the object and sprite dont seem to match up. I have taken the width/height of the FSprites on a 1x scale and scaled the objects accordingly. It might be a mistake on my end though, I am still getting used to C# and unity. You can see my example project trying to wrap the Physx engine and Futile over at https://github.com/tmuntan1/futile-physics.
@tmuntan1 Hmm, yeah I think the issue with yours is that the banana is a trimmed sprite, so using sprite.width and sprite.height (which return the untrimmed size) won't be accurate if you're expecting it to be the same size as the quad. Instead you could use sprite.localRect.width and sprite.localRect.height, although in a lot of cases the untrimmed size will be what you actually want.
Ok, thank you and I will check it out.
@tmuntan1 oh and note that if you do want to use sprite.localRect, you'll have to offset by the localRect.x and y as well because the trimmed quad is positioned based on the untrimmed image size, so the x and y will be slightly off if you keep them at 0,0
Thank you, it worked perfectly.
I got a basic prototype working well for physics of circles and boxes, I have no idea how to approach the complex polygon colliders though. Its still at https://github.com/tmuntan1/futile-physics.
I think the complex polygons will have to be done by creating a custom mesh and passing it to a mesh collider. I'm not sure whether a flat mesh will work or whether it'll have to be "thick" in the z dimension.
Sorry, I got tied up in something else for a while but I see that you have made some progress with your physics engine. Do you have any code that I can see on how to use your engine?
Yeah, have a look at http://github.com/MattRix/TOJam8