Do not compute physics for one body when a collision occurs
kedodrill opened this issue · 1 comments
Hi there, I am using raylib and Physac for a small game about space.
There are a couple of bodies I'm using, one for the sun and one for a test planet. The player is a planet as well and can move freely but is effected by a pull from the planets by using PhysicsAddForce(). I do want the player and other planets to be effected by their pull.
When the player collides with a planet (and that planet is moving), the players force changes (bounces off) but so does the planets (bounces away). Is there a way to make it to where the planet is not effected by the player?
I think basically what I want is body->enabled = false but only for collisions? I'm not sure exactly.
I saw this: https://github.com/victorfisac/Physac/blob/master/src/physac.h#L1251 and thought it might be in there somewhere...but not sure.
The game currently looks like this. The sun is not moving, the small planet is the player, the large planet is orbiting around the sun.
Thank you for any help with this and thank you for creating Physac :)
I'm guessing this requires some sort of collision groups or something more complex. I couldn't find anything in Physac that might address that, so I've switched over to using Chipmunk2D. Still enjoyed my time setting up Physac; it was super easy and intuitive!