Devlog: jumping and climbing
Added 2024-11-03 04:17:38 +0000 UTCI heard that the new Dragon Age game removed all rude dialogue options because no one is allowed to be mean anymore. So I'm adding more psychopath choices in CowHammer. I ain't telling you how to play. Dame Ternera is functionally mute, but you'll get a lot of options to royally screw everyone over if you want - it's even optimal for speedruns. And those choices will have consequences in the story.
Oct 27
I've made the colliders for all the complex objects in the first area of level 2. I've decided to handle cameras differently, because even creating two layers of colliders wouldn't be good enough. Instead, I'll just let the camera go through invisible walls. If I choose a good skybox, it shouldn't be an issue. So the next steps should be:
Export the main room and its collider, program the river's death trigger.
Export all blocking and climbable props, ensure that the climbing mechanics still work properly.
Export the breakable tree bridge, make it react to ramming and test that its collider is walkable.
Export the trap bridge, program its breaking animation.
Create a kickable block, program its physics, consider adding visual hint in game journalist mode.
Oct 28
I have learned how to load and unload areas, it's very quick and easy. However, loading level 2 has shown me that I made the first rooms way too small. That's okay. That's why we test. Back to Blender.
Nov 1
I had to do some Physics calculations to figure out how hard Dame Ternera must jump to reach any height I want. That'll be very useful when fine-tuning the climbing mechanics. Here's what I did:
The vertical position of a moving body is h(t) = v0t - Gt²/2, where v0 is its initial vertical velocity, G is its world's gravity and t is time. Its instantaneous vertical velocity is
h'(t) = v0 - Gt, which is the derivative of its position h(t) with respect to time tThe highest point of its trajectory is reached when h'(t) = 0. We can easily calculate that this happens when t = v0/G. Replace this value in the first equation and we get
h(v0/G) = v0²/(2G), which is the top height that the body will reach.The initial vertical velocity v0 needed to reach any desired height H is therefore
v0 = √(2GH). If we save constant V = √(2G) as the initial vertical velocity needed to reach height 1m, then we can slightly optimize this calculation as v0 = (√H)V
It works perfectly. Ternera now jumps exactly as high as I want her to.
Nov 2
All climbing mechanics are fully functional, including player interaction and HUD icon, since I chose to let the player decide when to climb, rather than having it be automatic. The projected shadow looks pretty bad when standing on the edge of a platform, but we'll handle that later. Maybe I can tweak the shader somehow so it doesn't show unless it's on top of something, or I can use more raycasts to detect if there's enough ground underneath. Either way, I can now go back to building Vecino forest.
Video: Climbing mechanics