0
\$\begingroup\$

I'm trying to make a billiard game, and trying to add "spin" (aka English) functionality. The way I'm using to add spin is by using AddForceAtPosition(). Here's the code:

if (Input.GetKeyDown(KeyCode.I))
{
    rb.AddForceAtPosition(-transform.forward * force, transform.position + offset, ForceMode.Impulse);
}

With offset being a vector3, that is currently (0,-0.5,0) , to simulate a bottom spin (aka Spin back/Screw back). But it's giving me very unrealistic results : enter image description here , the ball continues to gain torque even when there is absolutely no force being applied to it. As you can see in the code, it's a GetKeyDown() action, hence the force is only applied once. I'm using ForceMode.Impulse, but I don't get any better results with other force modes. Force value : 3 (tried multiple values, same results) Anyone knows why it happens? Thanks.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ First thing to come in mind is like a wagon-wheel effect, can you confirm with a debug log that the spin switches directions? (where it appears to be an optical illusion of things spinning the wrong way) \$\endgroup\$
    – Zibelas
    Jan 16, 2022 at 14:08
  • \$\begingroup\$ @Zibelas I'm not concerned about direction, I'm concerned about how it loses spin and then suddenly regains it unrealistically, it shouldn't happen at all. It should reduce gradually and not increase at any point. \$\endgroup\$
    – Haseeb Ali
    Jan 16, 2022 at 14:12
  • \$\begingroup\$ I've added higher framerate GIF now. \$\endgroup\$
    – Haseeb Ali
    Jan 16, 2022 at 14:15
  • \$\begingroup\$ How you know it gets more spin? \$\endgroup\$
    – Nikaas
    Jan 16, 2022 at 14:15

1 Answer 1

0
\$\begingroup\$

As Zibelas suggested in the comments, this is due to the wagon-wheel effect:

The wagon-wheel effect (alternatively called stagecoach-wheel effect or stroboscopic effect) is an optical illusion in which a spoked wheel appears to rotate differently from its true rotation. The wheel can appear to rotate more slowly than the true rotation, it can appear stationary, or it can appear to rotate in the opposite direction from the true rotation.

Here your ball is rotating so fast, the stripe that was facing the camera last frame rotates all the way around to the far side of the ball by the next frame, and what we see facing the camera is the other half of the stripe. But our eye will assume we're still looking at the same part of the stripe, which is not that far from where we last saw it, so we perceive a reduced speed of rotation based on that cue.

As the ball's rotation slows down, the other half of the stripe starts falling further and further behind where its counterpart was on the previous frame, which means we see a larger and larger visible change between frames, and paradoxically it looks like the ball is speeding up. But it's just an artifact of the mismatch between the strobing of the frame rate and the rotation period of the ball.

(One way to confirm this: write a script that logs the angular velocity of the ball, of the magnitude of that vector, on each frame. You'll see that numerically it's only decelerating, even if it looks like it's accelerating on screen)

Reducing your offset from the center can give it a more gentle spin, so you don't hit the extreme rotation rates where this effect appears.

Or, if you need high spin rates for your gameplay, you can use shader tricks to smear the visuals when they're moving too fast for a camera to capture them in a single frame's exposure. This motion blur will hide the cues our eyes are picking up on to perceive the wrong spin rate, so that the effect isn't distracting for your players.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .