I am familiar with how to collide with regular shapes (like rectangles) but what if I have an object hidden behind an image like this: https://raw.githubusercontent.com/Jello ... eplat1.png
How do I create an object w/ a fixture for that so my other object (representing a player) can collide with it?
I don't think this needs a particular .love, but I'll attach one anyway (BEWARE: Spaghetti code).
In the .love, I made the drawing of the platform image a comment so there's just a circle at the moment.
Also, ignore the fact that the ball is falling and the rectangle is stationary, in this game the platform is supposed to move while the player does her animations in the center and the stage moves around her. This is so the player is always in the center. There is probably a much easier way to do this, but I've already committed to this bad idea. Regardless, this is a thread about the body.
tl;dr irregular bodies for colliding with?
Collision/fixtures with irregular bodies?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 3
- Joined: Sat Jun 25, 2016 10:54 pm
Collision/fixtures with irregular bodies?
- Attachments
-
- BleedAgain.love
- (2.04 MiB) Downloaded 125 times
Re: Collision/fixtures with irregular bodies?
love.physics or Box2D works with:
-convex polygons up to 8 vertices
-edges
-circles
So you have to use these shape types to represent whatever you need.
Also, if you're doing this by hand, it's probably better to start in reverse -
you create a map of polygons that actually works and is playable in Box2D,
then you slap an image on top that approximately fits your map.
-convex polygons up to 8 vertices
-edges
-circles
So you have to use these shape types to represent whatever you need.
Also, if you're doing this by hand, it's probably better to start in reverse -
you create a map of polygons that actually works and is playable in Box2D,
then you slap an image on top that approximately fits your map.
-
- Prole
- Posts: 3
- Joined: Sat Jun 25, 2016 10:54 pm
Re: Collision/fixtures with irregular bodies?
Alright, sounds like a good idea! Thanks for the tip.ivan wrote:love.physics or Box2D works with:
-convex polygons up to 8 vertices
-edges
-circles
So you have to use these shape types to represent whatever you need.
Also, if you're doing this by hand, it's probably better to start in reverse -
you create a map of polygons that actually works and is playable in Box2D,
then you slap an image on top that approximately fits your map.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Majestic-12 [Bot] and 6 guests