1 Reply Latest reply: Nov 10, 2012 8:27 AM by jsmith RSS

    Bounce in 3D

      Hi everybody,

      I googled for instructions how to make 3D bouncing, but I have not found anything. Can anybody help me, please?

      I am beginner with programming and I will be thankful for any advice.
        • 1. Re: Bounce in 3D
          Physics background:

          Programmatic formula (elastic deflection section) - you'll need to convert that code snippet to Java:

          Quoting a gamedev forum 2d answer (last post here: http://www.gamedev.net/topic/615690-calculating-angle-of-deflection/)
          the reflected vector is: V - 2N(N.V) where N.V is the dot product of N and V, if you don't know what the dot procut is, then N.V = Nx*Vx + Ny*Vy, so that you end up with the vector { Vx - 2*Nx*dot, Vy - 2*Ny*dot } <-- no trigonometric functions needed.
          Just use 3d vectors (with z coords) rather than a 2d ones with only x and y. Also reduce the velocity to account for the energy lost in the bounce.

          You'll find the functions you need in the Point3D class:
          Use jdk8 to get a version of JavaFX that includes these methods: