Download

[REQUEST] Basic Ball Bat tutorial

I’ve been using Unreal for about 8 months now and was working on mostly FPS and 3rd person games, which if you are using Unreal is great, because there are a ton of tutorials on how to create those types of games, but now I’m interested in making a VR golf game and I’m stuck on the very basics of the game concept, like how would you create a golf club that can hit the ball. There is literally nothing out there on how to set this up. I think if someone was to do a tutorial on a basic have a bat hit the ball type game then it could open up the door for a lot of other games to be made like tennis, Golf, pinball any game really where you have an object hit a ball.

Hi. I think a simple approach to this (in the case of golf) would be using a physics actor for the object to be hit, then adding an impulse to it based off some input from the player - say a meter or gauge like in the PGA tour games. The actual hitting of the ball would simply be an animation playing i.e. the character does a swinging animation and has the golf club object attached to the hand socket, then event triggering the impulse to the ball to make it move in the desired direction.

Yeah that’s basically the best method, it is possible to attempt full physics of the bat hitting the ball but you need very high time steps to make it accurate. Something like a golf game has a huge advantage of at least one element being stationary before impact. In games like Tennis, Baseball, Cricket etc, the ball is moving towards the moving bat/racquet so fast that you normally only have 2-3 frames where there could even be a potential impact. We normally warp the speed of the ball/bat to make them visually collide at an impact point and fake the trajectory of the ball. Its possible to recalculate the whole trajectory before impact based on the users input.