In the spirit of March Madness, I wanted to toy around with trying to make a simple basketball game. I’m having some problems though…
I have a “ball” blueprint that I’ve attached to my character’s hand. I WANT him to release (shoot) the ball when the player releases the space bar (jump button) and have the ball leave his hand and arc towards a set target (a basketball hoop) with variable results (makes and misses).
I’m not entirely sure where to start…I figured MAYBE I should add a homing projectile component to my “ball” blueprint? But even then, I’m not sure how to have this ball blueprint leave the player’s hand and ARC towards a target point. Any pointers here? All the projectile tutorials I’ve looked up refer to spawning projectiles…which is certainly not what I want.
No need to use a homing blueprint (unless you want to auto target the hoop without aiming manually at all). You’d want to look into attaching your ball to a socket on the character’s hand, detaching from the socket when trying to make the shot, and figuring out a vector force so that you can add impulse to the ball at the second it detaches. The transition from kinematic( object that moves where it’s told (like when attached to a socket)) to physics object is a little tricky. A kinematic object needs to have no simulate physics enabled and no collision enabled, in that order. The physics object needs to have collision enabled and simulate physics enabled, in that order. To get a vector that you’d like for launching, I’d suggest testing any potential angles by simulating them with a line trace node.
As for variable results, I’m not sure if you mean relying entirely on physics to see if it will work or doing something a little more scripted. In the case of the latter, maybe you can make a few different matinee sequences that you can randomly switch between when the ball enters a trigger volume on the basket.
These are my ideas. If you’d like a homing component better, I can tell you about that too.