Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

Gamedev Experiments

A collection of gamedev experiments cut down to small digestible projects · By Pigdev

Blend Space instead of Tilting for Slopes

A topic by Pigdev created Jul 11, 2020 Views: 103
Viewing posts 1 to 1
(2 edits)

You know, when I was experimenting with tilting on slopes I couldn’t stop thinking that it is quite weird to have a character tilting on a slope, especially if they aren’t 1:1 proportion ratio.

I think it works kinda nicely for vehicles, or maybe characters that aren’t bipeds, right? Like an alligator…I guess?

I mean, no…it doesn’t make sense for organic stuff. Maybe for cars or whatnot.

So I was thinking about solutions for a biped character to animate on slopes, and I thought about using 1D Blend Spaces to blend between a walking animation and a “climbing” animation and using the blend space to interpolate within these animations depending on the angle of the slope.

So I’ve made a small experiment, I’ve created 2 animations, one where the character is “normal”, one when the character is fully “climbing”…I had to abstract it as just scaling the character on the y-axis, don’t judge me. Try to imagine a character on a better pose, like a person climbing a stair, I dunno, use your imagination.

Using the absolute aspect ratio of the slope’s normal, I was able to get the proper blend position and assign it to the AnimationTree node.

If you are curious, these are the lines that execute this logic:

func _tilt():
	var blend_position = 0.0
	if is_on_floor() and raycast.is_colliding():
		var normal = raycast.get_collision_normal()
		blend_position = abs(normal.aspect())
	anim_tree.set("parameters/blend_position", blend_position)

So, yeah I think that using the proper animations this can be a better approach to animate characters on slopes, as you can see the character blends according to the angle, so you can imagine a walking animation blending with a climbing animation where lower angle slopes don’t change the character pose that much, but with higher angle slopes the character changes completely to a climbing animation.

And note that since we can animate any property…we can export the character’s move_speed to the inspector and animate it as well, decreasing it in the climbing animation, and since we would blend between those animations, the speed would interpolate accordingly.

The possibilities are infinite! Anyway, that’s just some thoughts I had when experimenting with tilting on slopes.