Ball Launcher (Unity)
A downloadable game for Windows
Ball Launcher Simulator
Introduction:
This is a simulation software for a ball launcher.
The ball launcher operates by electromagnetically holding the ball in place until it is released. The ball is held in firmly in place electromagnetically and can be released at any time.
The motor that drives the arm can apply a torque up to 2 NM until a maximum speed of 20 radians per second is reached.
The cylinder is made of 6061 aluminum alloy and the ball is made of solid 1018 steel. Weight of electronics and wiring is negligible.
The idea is to create a Simulator to find the optimal parameters for launching the ball to achieve specific travel distances. This involves modeling launch distances as a function of the starting angle, motor torque, and ball release angle.
This allows to experiment with different motor configurations by testing various possibilities for the motor’s torque and maximum speed. This exploration will provide insights into how these values affect the ball’s maximum travel distance and overall performance.
Software used:
The Simulator was done in Unity 2021.3.11f1 using C# for scripting with VS 2019.
C# is also a very powerful programming language with features like garbage collection, inheritance, many collections and useful libraries for math & physics.
I didn't use Unity physics Engine dynamics to calculate trayectories of the Ball Launcher. Instead I used it only to render the simulation (with kinematic rigid bodies). All the translation/rotation was handmade with scripting. I also used colliders instead of rigid bodies onCollision events.
I calculated the momentum of inertia programatically so it's also documented in the code and it's easier in the future to change dynamically the sphere or cylinder parameters.
Key Features:
- The Simulator is very straightforward and has a minimalistic UI with all the necessary components to help the team's goal of creating the best possible ball launcher.
- It can control the following inputs: Start Angle (º), Stop Angle (º), Torque (Nm), Speed Limit (rad/s), Gravity (m/s2), Heigth (mm).
- At runtime it's possible to pre-calculate the output parameters all with physics equations (green target) as well as simulate using kinematic rigid bodies and scripting in FixedUpdate() to see frame by frame the execution of the launch (yellow target).
- The Simulator has visualization of the following outputs (for both calculated and simulated): Target in X-Z coordinates (mm), Launch Distance (mm), Max Angular Speed (rad/s), Time of the ball in air (s).
- Is possible to set the camera in 2D (XZ plane) or 3D to have a better view of the launch.
- Two fixed positions for Near and Far camera. Axes or Circles can be de/activated for better visualization as well.
- It has export feature to save all the important launch data to a csv file for further data analysis or graphics creation.
Final thoughts:
I found this task to be very entertaining and fun. As an Electronic Engineer I always liked software development, robotics and physics.
I Have some robots and IoT projects in my house I like to play with from time to time. I like creating videogames as well.
I also enjoy improving my software development skills: I have learned some stuff regarding Unity framework I didn't know. I had also to review some physics concepts during the development of this.
I used some help from OpenAI also. I think is a powerful new tool for software development and it's necessary to know how to use it nowadays.
Published | 10 days ago |
Status | Released |
Platforms | Windows |
Author | Bandolero Games |
Genre | Simulation |
Tags | Robots |
Download
Install instructions
This Simulator can run in a Windows PC in fullscreen mode. It's not necessary to install any dependency to run the built version.
Just run BallLauncher.exe for execution.
Leave a comment
Log in with itch.io to leave a comment.