Genbox / VelcroPhysics

High performance 2D collision detection system with realistic physics responses.
MIT License
666 stars 113 forks source link

PolygonTools.CreatePolygon(uint[], int Width) #36

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hey Velcrophysics,

I just realized I'm absolutely outdated because I was still using Farseer Monogame. I'm currently creating my own game engine library that has similar functionality to Game Maker, and since I've been including the direct source of all libraries I use I also decided to add Farseer.

Problem is that since you guys have changed to Velcro Physics, and I just added the source to my library, I can not find the PolygonTools class. I think I used an unofficial Monogame version of Farseer that may have had this class already included (do you guys know what it is?)

I used this class to create a polygon out of a Texture2D like so;

   ` /// <summary>
    /// Converts a texture to a compound polygon.
    /// </summary>
    /// <param name="Texture">The texture to create a compound polygon out of.</param>
    /// <returns>The compound polygon. Note: These are not scaled for Farseer Physics.</returns>
    public static Vertices GetTexturePolygon(Texture2D Texture)
    {
        uint[] Data = new uint[Texture.Width * Texture.Height];
        Texture.GetData(Data);
        return PolygonTools.CreatePolygon(Data, Texture.Width);
    }`

FixtureFactory.AttachCompoundPolygon(GetScaledVertices(), 1f, Body);

Does it still exist? If it does, does it automatically scale? Because I'm using a PolygonTools.CreatePolygon that I later have to scale using ConvertUnits.ToSim(1f) -> This makes it an absolute charm to use these polygons in other instances where I don't want to scale them.

Regards,

Genbox commented 7 years ago

Continue to use Farseer Physics Engine for now. Velcro is subject to major changes and won't be stable for some time.