This might be a stupid question, but I'd really like to get some stuff clarified.
I'm trying to do collision detection for complex shapes (convex and concave polygons), but I don't care about real-world physics. I just want to know when bodies are touching, so I can apply my own simplified physics rules.
I've tried using HardonCollider but adding custom polygons to the HC class, and subclassing, is a massive headache. Is it possible to use the built-in love.physics to just do collision, without any of the physics stuff?
Would there be a big performance problem if I did that?
Complex Collision Detection Without Physics
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Denver, CO
- Contact:
Re: Complex Collision Detection Without Physics
HC does concave and convex polygons. What sort of shapes were you trying to subclass?kexisse wrote:I'm trying to do collision detection for complex shapes (convex and concave polygons), but I don't care about real-world physics. I just want to know when bodies are touching, so I can apply my own simplified physics rules.
I've tried using HardonCollider but adding custom polygons to the HC class, and subclassing, is a massive headache.
Re: Complex Collision Detection Without Physics
I have level terrain that consists of arbitrary polygons. I wanted to subclass one of the 3 (or more?) Polygon shapes in HC (I don't know which is best to subclass). I tried using composition rather than inheritance (my Poly has a reference to a shape), but I end up duplicating vertices, positions, width/height, and having to update both my Poly and the HC Shape every time I move or change anything. Also I tried inheritance but as far as I understand it's not possible to add custom shapes to HC, you have to use the addRectangle() etc. methods.
At the moment I have my composition hack and it sort of works, but it feels like the wrong way of doing things. My terrain does not Have a collision shape, it IS a collision shape.
At the moment I have my composition hack and it sort of works, but it feels like the wrong way of doing things. My terrain does not Have a collision shape, it IS a collision shape.
Re: Complex Collision Detection Without Physics
I don't have any experience with HC, but if you wanted to use love.physics stuff, you'd still need to do composition. I guess that where you come from, inheritance is the way of dealing with things, but here you have to be flexible, as Lua is a multi-paradigm language.kexisse wrote:I have level terrain that consists of arbitrary polygons. I wanted to subclass one of the 3 (or more?) Polygon shapes in HC (I don't know which is best to subclass). I tried using composition rather than inheritance (my Poly has a reference to a shape), but I end up duplicating vertices, positions, width/height, and having to update both my Poly and the HC Shape every time I move or change anything. Also I tried inheritance but as far as I understand it's not possible to add custom shapes to HC, you have to use the addRectangle() etc. methods.
At the moment I have my composition hack and it sort of works, but it feels like the wrong way of doing things. My terrain does not Have a collision shape, it IS a collision shape.
As for duplicating vertices, positions, etc. why not use get/set methods instead?
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 56 guests