Trying to make a square not spin when it's on a platform.

Hey everyone.

I made a square sprite with physics settings to make it so that it can bounce (square, “dynamic”, {radius = 50, bounce = 0.4, friction = 1.0}). Bounce makes it so that it will bounce once it touches a surface. The friction is there so that once it hits a static wall in my app, it will spin around.

The goal for the square is to stop moving once it hits the platform a few times and land on a specific side.

Now, I’m having trouble making the square stop moving because the radius acts as a circle at the center of the square, making it so that the corners are essentially just empty space. As a result, the “square” not only spins around on the platform, the corners stick through as well.

Any suggestions are welcome!

Check out isFixedRotation

–john

I’m curious as to why you’re using a radius when the sprite is square as generally it is only used for circular sprites. Remove the radius parameter and it should then be what you’re after (if I’ve understood your question correctly).

I actually find the solution.

I removed the radius parameter. What the real issue was, I was using applyLinearImpulse, making it so that without the radius, the square would not rotate even when it bounces.

Instead, I used applyTorque, which allowed it to spin around whenever it started to bounce.

Check out isFixedRotation

–john

I’m curious as to why you’re using a radius when the sprite is square as generally it is only used for circular sprites. Remove the radius parameter and it should then be what you’re after (if I’ve understood your question correctly).

I actually find the solution.

I removed the radius parameter. What the real issue was, I was using applyLinearImpulse, making it so that without the radius, the square would not rotate even when it bounces.

Instead, I used applyTorque, which allowed it to spin around whenever it started to bounce.