Wobbly Player Physics - RH
"Wobbly Player Physics"
Author: Ryan Hewitt
Posted on 8/21/2024
The biggest challenge this week was getting the player physics to feel right. It's far from perfect, but at least we are in a functional state. Creating physics for a unicycle riding wizard posed some interesting problems to solve. The goal with this character was to have it be able to move around with all the normal platformer movement, but have the added stress of balancing on the unicycle. There are several things I had to take into account when solving this issue, such as all the different kinds of forces that could be applied to the player's rotation about the wheel.
To begin there is some basic setup, like having two separate sprites for the wizard and the wheel, as well as having the pivot points correct for the rotations. The first real step I took to solve this issue was to figure out all the possible forces that could affect the rotation about the wheel. These forces include the opposite rotational force on the wizard when the wheel moves in a given direction, the gravitational force, the force of the player leaning using the w and s keys, and the knockback force received from the enemies. All these forces get added together and applied to the rotation of the wizard every frame.
The calculations for most of these forces are fairly straight forward. Gravity was pretty tricky to figure out, but the solution ended up being pretty simple. Eventually, I figured out you can get the angle of the sprite, and that while it is pointed straight up or down the angle is 0, while when it is pointed left or right it is at 90 and -90 degrees respectively. So, I can take the angle divided by 90 to get a ratio of how much gravitational force should be applied, since when you are at the top or bottom of the rotation you shouldn't be rotating anywhere, but when you are on the left or right the force will be at its peak. The fact that it already is 90 and -90 degrees for the two sides helps to differentiate whether I should be applying a clockwise or counterclockwise rotation for the player to appear as if they are rotating downwards.
Wizard On A Unicycle
Status | In development |
Author | fullsailwinningteam |
Genre | Platformer |
Tags | 2D, Pixel Art |
More posts
- Fun with Behavior Trees -DCAug 30, 2024
- Secondary Fire - GVAug 30, 2024
- CT-Level 1 CreationAug 30, 2024
- CT-Creating the Tutorial MapAug 30, 2024
- L Win Menu - RHAug 29, 2024
- Menu UI Isuues - JDAug 24, 2024
- Conflicting CollisionsAug 23, 2024
- Unknown Inputs - GVAug 23, 2024
Leave a comment
Log in with itch.io to leave a comment.