1
$\begingroup$

I am trying to make objects bounce off of a circle in a realistic direction.
object bouncing off of a circle

The equation is $new = \theta - 2N * \theta N$
Where $\theta$ is the object angle in degrees,
$new$ is the new object angle in degrees,
and $N$ is a vector pointing from the circle origin to the object.

But if $\theta$ is 0 then as you can see here it doesn't work:

The object direction and normal are 0:
new direction = 0 - (2*0) * (0*0) = 0 - 360 * 0 = 0 (the direction did not change)

My question is, how can I modify this formula without making a special case when the object direction is 0$^{\circ}$?

$\endgroup$
  • $\begingroup$ The normal is not $180^o$, it's $0^o$. $\endgroup$ – K. Rmth Dec 14 '13 at 19:00
  • $\begingroup$ Thank you for your response. I have fixed my error. $\endgroup$ – person27 Dec 15 '13 at 17:58
  • 1
    $\begingroup$ Could you label a figure of an example that does work, clearly labeling the angle $\theta$ so we can see what is meant by "the object angle"? Also, if the formula is $\theta - 2 N * \theta N$, and N is a vector, why do you write 0 - (2*0) * (0*0) while evaluating a new direction? It looks like you are substituting the scalar value 0 for the vector N, which makes no sense. $\endgroup$ – David K Apr 4 '14 at 1:37
  • $\begingroup$ @DavidK I knew a lot less back then than I do now regarding trigonometry (I didn't even know what radians were). I answered my question below; the formula was wrong. I apologize for not revisiting this question earlier, I suppose I had forgotten about it. $\endgroup$ – person27 Apr 5 '14 at 23:05
  • $\begingroup$ I should pay more attention to the dates on postings. But I'm glad it worked out for you. Your diagram is crystal-clear. $\endgroup$ – David K Apr 6 '14 at 2:36
1
$\begingroup$

Nevermind this question; I had the formula wrong.

object bouncing off of a circle

The equation is $V_{fd} = N_d + (N_d - V_{id})$
Where $V_{id}$ is the initial vector's direction in radians,
$V_{fd}$ is the final vector's direction in radians,
and $N_d$ is the normal vector's direction $\perp$ to the tangent and pointing outwards.

At the point of impact, the initial vector that describes the object's movement changes direction by a certain number of radians. As you can see, the difference in radians between $V_{id}$ and $V_{fd}$ is $2\theta$ because it is the sum of angles formed by $\angle NF_{id}$ and $\angle NF_{fd}$, which are always equal.

The equation now works when $\theta$ is $0$:

If $V_{id} = \pi$, then $0 + (0 - \pi) = -\pi$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.