Jump to content

Interpolation lines for collisions?


hollowdoor
 Share

Recommended Posts

Oh. Here is how to do it. I gotta search the docs better.

 

I can generate my point arrays, and give them to a bitmap data object for a texture.

 

The bitmap data can be used as a sprite, and I can give that same point array to addPolygon of the P2 body of the sprite.

 

How about that? Turns out it's not so hard.

 

Now I don't know if this should be a question warranting a new thread. Is there a way to clip a sprite's image with a polygon? This would be useful to cut every part of the image that's outside of the polygon area. It would allow almost any shape with any texture.

 

Thanks for the help guys.

Link to comment
Share on other sites

As an addendum it might also be useful to use interpolation on a polygon's points to get smooth curves. Then I can use the original polygon for the physics body. Per the needs of my original question.

 

The polygon would have to have a lot of points, and there would also be a clipping problem with the interpolated lines too. It would be worth it though.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...