Question

When one physics object collides with another, unlike in the real word, it doesn't necessarily bounce off. I've found that if a circle hits another circle at close to a tangent angle or hits a moving object it "sticks" to it and slides up/down/across the edge of the physicsBody rather than bouncing off.

Increasing the restitution of the physicsbodies simply results in harder rebounds off of non-"close to tangent" collisions.

Does anyone know of a solution for/cause of this?

Was it helpful?

Solution

You can check out the different properties here:

Each individual body also has its own property values that determine exactly how it reacts to forces and collisions in the scene. Here are the most important properties:

•The mass property determines how forces affect the body, as well as how much momentum the body has when it is involved in a collision.
•The friction property determines the roughness of the body’s surface. It is used to calculate the frictional force that a body applies to other bodies moving along its surface.
•The linearDamping and angularDamping properties are used to calculate friction on the body as it moves through the world. For example, this might be used to simulate air or water friction.
•The restitution property determines how much energy a body maintains during a collision—its bounciness.

Other properties are used to determine how the simulation is performed on the body itself:
•The dynamic property determines whether the body is simulated by the physics subsystem.
•The affectedByGravity property determines whether the simulation exerts a gravitational force on the body. For more information on the physics world, see “Configuring the Physics World.”
•The allowsRotation property determines whether forces can impart angular velocity on the body.

here is the link: sprite node properties

If none of these work, you can possibly try using the usesPreciseCollisionDetection property on the physics body

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top