Fun with physics
A downloadable game for Windows
Left Ctrl : Accelerate
Space Bar : Cancel planetoid’s gravity
This week’s entry is more of an experiment than a game. I wanted to continue on learning how to implement my own physics components. So I decided to try and understand the mechanics behind Mario Galaxy’s planetoids gravity system.
What went well
Thanks to an article I found on gamasutra’s blog, I was able to understand the core of mario galaxy’s physics which is simpler than I imagined. Thanks to a simple line trace that goes from the bottom of the player to the surface of the planetoid, we can orient the player depending on the normal of the surface which is hit by the line trace. Then, we just have to apply to the player a gravity force that goes along the vector pointing from the player to the planetoid’s center.
What went wrong
I had a really serious problem during my implementation. During three days, I was struggling with the planetoids surface normals that were incoherent and were provoking a lot of instability in my simulation. After a lot of trial and error, I finally found that this was a bug report in the engine that has never been addressed since 2014 >_< !!! Just so you know, Pitches in UE4’s rotators have a limited range that goes only from -90 degrees to 90 degrees. If you try to input larger values, they will be clamped to [-90 ; 90] and the rotator’s Yaw and Roll are likely going to flip 180 degrees depending on your input. This is true for blueprints and I don’t know if this does the same when coding with C++. Because of this major issue, I couldn’t finish my game in time and so I decided to make experiments with gravity instead.
What I learned
Despite the fact that I consider this week’s challenge a fail, I learned a loooot of things :) For starter, I will be aware of this rotators’ limitations in the future. I also learned a lot about the gameplay mechanics of Mario Galaxy, which is one of my favorite games of all time. I plan on retrying to implement this mechanics, but this time using C++. Maybe this will work better. Finally I continued on learning how to implement custom movement components, which is fun if you’re interested in game physics.
Leave a comment
Log in with your itch.io account to leave a comment.