Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+13 votes

I followed the instruction and everything worked just fine until I came to create the deadzone and collision layer, then the player didn't touch the ground and keep falling. Does anyone encounter the same problem?

func _physics_process(delta):
if is_on_floor() == false:
	velocity.y += gravity*delta
	if velocity.y > 500:
		velocity.y = 500
asked in CSC380Jan2024 by (1 point)

4 Answers

+5 votes

Make sure the player and ground do interact with each other. I had the same issue.
Set the collision layer and mask for the ground and player respectively. Make sure the ground is included in the player's mask and vice versa.

answered by (1 point)
+4 votes

A lot of possible problems, both player and ground need to have collision shapes of course, make sure the player and ground have collision in their layers and masks. Your code there looks the same as mine and it’s working so I don’t think your problem is there. Just some possibilities, hope this helps.

answered by (1 point)
+1

it does! thank you so much!!!

0 votes

it might be because the collision mask of the player and the ground might be different

answered by (1 point)
0 votes

you might want to see if the player is set above the map or not too

answered by (1 point)
...