i have created a platformer using a characterbody2d with a rotating level and had some issues with the player clipping through the floor and getting stuck either inside the floor.
or outside the level.
i am currently looking for some way to prevent this from happening.
i have tried to do
velocity /=10
for i in range(10):
move_and_slide()
velocity*=10
instead of just calling move_and_slide as i assumed that calling it in smaller steps would allow it to have better collision accuracy but doing that caused the walljumping to break sometimes and i couldn’t figure out why so i had to revert this change.
i recently seen this video https://youtu.be/JlgZtOFMdfc?t=210 and it talked about how the characterbody3d doesnt interact with other rigidbodies but a rigidbody3d will, i was wondering if the increased interactivity of the rigidbody2d will cause the player to not get stuck in the floor.
window is what is being rotated, n is just make it rotate from the center instead of the top left corner, player is characterBody2D border TileMap is the tilemap, each level inside levels is a tilemap
to rotate the floor i have this inside the window script
func _process(delta):
if abs(rot_target - rotation_degrees) < 5:
rotation_degrees = rot_target
else:
var extra = (abs(rot_target - rotation_degrees) / 3000)
if extra < 1:
extra = 1
if extra > 4:
extra = 4
if rot_target > rotation_degrees:
rotation_degrees += rot_speed * delta * extra
else:
rotation_degrees -= rot_speed * delta * extra
get_node("ui").rotation_degrees = -rotation_degrees
extra is so that if the target is far ahead/behind it will spin faster to reach the target more quickly
also this game is 2d not 3d i just typed it wrong in the title, but that should be fixed now.
the only errors on the tilemap are saying that i should use tilemaplayer instead.