Cannot get the player to rotate on slopes larger or smaller then 45 degrees!

Godot Version



So. I am having issues with rotating the player on slopes larger or smaller then 45 deggrees. This is the code:

This is what it looks like:

if (is_on_floor()): #Checks if the player is on the floor...
		canJump = true #If so, set the canJUump variable to true
		jumpCount = 1 #And set the jumpCount to 1, to reset the jump
		var floorNormal = get_floor_normal()
		var slopeAngle = atan2(floorNormal.x, floorNormal.y) - PI/2
		rotation = slopeAngle

If you need more details, i can give you them :smile:

For more context, i will say that the player doesnt properly match the slopes angle, if that gave more conext to the issue i am having :smile:

try setting the floor → max angle property of the player to a value greater than 45 degrees

Nope! It still has the same wonkyness to it! This is how it looks like:

Hope this cleared up something :smile:

then it’s probably something wrong with the slope angle formula. try -atan2(floorNormal.x, floorNormal.y) - PI / 2. If that doesnt work just fiddle around with the the formula im not too good at math


YIPEEEEEEEE! It worked :smiley:
Thank you soooo much :smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.