[Day 1] Ball and Bat
Today's goal is to program the basic mechanic of the game: hitting a ball with a bat.
Approach
Starting from scratch, I had to import assets from the Unity Asset Store to get myself something to work with. The only asset that I needed was a 3D bat that I can swing, and that was easily found with a search of free baseball bat assets. All other assets, such as the bases, walls, and field could be easily created with primitives such as cubs and spheres. Even I remember how to do that- if I didn't, those 3 months of being taught by Blizzard employees really would have gone to waste xP
I was not too worried about the aesthetics of the game at this time. In previous hackathons that I competed in, we only had 36 hours to complete our projects from start to finish. I knew that with this game jam lasting way longer than 36 hours, I would have time to draw up things later. I plan on visiting the field that Guzman plays on and have a photoshoot so that we can get sprites for his teammates and him as well as finalize the dimensions of the (weirdly-shaped) field. Furthermore, this is my first true 3D game, and I've primarily done games in a 2D game engine, GameMaker: Studio- so I'd rather learn how to get the collisions working first.

Above: The ball launches off the box collider of the bat.
Simplification of Physics/Colliders
There are many tutorials online on how to create such a game (especially in Unity VR) and for the most part, I followed them. However, I had to remind myself that this game is called the Guzman HR (home run) Derby- our good friend Guzman always hits home runs. Therefore, instead of using a cylinder collider for the bat, I used a rectangular collider. On a collision event, I added a forward and upwards force to the ball, launching it directly into the seats! It is guaranteed that the ball does not land within the boundaries of the field (it will either be a home run or a foul ball) so I was not worried about adding collisions/features to the field.
Going with the "HR Derby" approach allows me to "cheat" the collision mechanics by forcing the ball to always go up and forward towards the stands. I do not need to create a complex collider to handle what happens if the ball is hit towards the ground, etc- because, well, Guzman always hits home runs.
Testing
We can test this implementation by binding the bat to a key and the ball to another key. The bat key swings the bat, while the ball key launching the ball from the pitcher's mound. As we can see in the gif above, the basic implementation seems to work well enough.
Next
Coming up next, we will need to implement the basic scoring mechanic of the game. This is actually easy- we can use invisible triggers along the outfield wall to determine if a ball is a home run or a foul. In an actual baseball game, if the ball clears the outfield wall between the foul poles in left/right field, then the ball is a home run.
We will need:
- A score controller object to track the score and draw it
- A game controller to determine if the ball is a home run
- Stretch goal: a game controller that launches the next ball after a determination is made.
-Browntul