Calculate Input Direction and Throw Ball/Object
Hello again dear friends!
I'm trying to throw my game ball in a specific direction based on thumb stick input.
I will admit, calculating direction from my gamepad has been an issue for me and my project. I'm not sure I'm 'getting' it.
With that said - I'd like to prototype a pass/throw ball mechanic into my sports game.
I would like to press and hold a "pass button" and bring up a interface interaction where the right thumbstick now moves a reticle in the desired passing location (rather than moving the game camera) and then on release, shoot the ball in that direction.
This is a bit over my head and I've barely started.
I'll show you a mock-up I did that goes from default player view to pass button held and interface direction calculate based on player aim. Of course on release, the interface would drop and the ball would be thrown that way.
My current plan is the player can pass in a half circle in front of them, 180 degrees. Not behind.
Here is what I have currently. I only have the ball being flung in the direction of the camera.
Here is my blueprint. It is very bad. And embarrassing. Did I say bad?
What I'm doing is moving the ball to the hand socket, playing an ugly aim animation, detaching the ball and then quickly after hitting the ball with some force based on the camera direction. I'm unsure of how to calculate input direction and then add force toward that direction.
Also - I don't really know how to "arc" said ball. I'm hitting it with 2 forces, 1 to throw down field and 1 in the up axis so it has a bit of arc. Not sure if that's the best way.
So, this is a multi-part question:
-How to best get thumb stick input to have an effect on some kind of game/world direction.
-How to throw something with force in said direction.
-How to get some kind of interface up, and a new state that doesn't turn the camera, and some kind of rotation on the widget interface to show direction intent.
4 BONUS. Can I do a quick hold and direction nudge for a short pass and a longer hold to "max out" the pass distance. Essentially tap for short and quick pass or hold for a longer "hail mary" style pass.
Whoever even tries to read all this and answer is a saint.
Follow this question
Once you sign in you will be able to subscribe for any updates here