Calculate Input Direction and Throw Ball/Object

  • We discussed making the ball be ‘lobbed’ more (i.e. thrown with a higher arc) if the thumb stick is only pushed partway. What this means in my head is, when the magnitude of the throw input vector is lower, the ball gets a larger Z impulse (causing the ball to fly higher). When the magnitude of the throw input is higher (i.e. the stick is pushed farther), the ball gets a lower Z impulse (causing a more bullet-like throw).
  • So the relationship between the thumb stick input and the impulse’s Z component is inverse-proportional, or something like: (1 - MagnitudeOfThumbStickInput) * MaximumUpwardImpulse
  • (In that preceding equation, MagnitudeOfThumbStickInput is required to be normalized to a range of 0 to 1)
  • Similarly, the ball’s horizontal speed when thrown should be proportional (not inverse this time) to the stick’s input magnitude. Something like: MagnitudeOfThumbStickInput * MaximumHorizontalImpulse
  • Essentially, the results of those two simple equations will be combined into one new 3-dimensional vector, which will then be fed into a physics impulse function (such as this Add Impulse node) to actually cause the ball to be launched

To be sure, variables like those I called MaximumUpwardImpulse and MaximumHorizontalImpulse will need to be tuned a lot to find values that feel right.

Also, you may need to ignore thumb stick input magnitudes below a certain minimum, using a branch node or something, because when the thumb stick is barely pushed, it may be that the player isn’t consciously aiming yet (this is very much like setting the dead zone for the thumb stick, and that may be the better way to handle this, but that depends on which is easier for you)

I might think of something else to dump in a little bit, but that’s all I had loaded in mind-memory for now.

Hopefully that thought-spew makes sense and helps, somehow, in some incredibly improbable way.