I created a ground and a player but I want the player to fall off the ground when he leaves the ground but he keeps running on the same z-axis without falling
Asked
Active
Viewed 76 times
1
-
1Alexander Welcome to Stackoverflow. With this state of the question we can not reproduce or even guess what the problem is. Can you elaborate more on your question? Add screenshots of the problem and the script that is not working. – Ali Kanat Apr 04 '19 at 08:28
-
1I can’t post images since I don’t have 10 reputations – Alexander Udhude Apr 04 '19 at 08:51
-
1You can post your code though – Ali Kanat Apr 04 '19 at 08:52
-
1It’s not about the code – Alexander Udhude Apr 04 '19 at 08:53
-
1What I’m trying to say is my player won’t fall once he leaves the ground. Because my game is about a player running on a ground and falling down to another ground. But my problem is he won’t fall when he leave the ground but keeps running on the air without any ground under him – Alexander Udhude Apr 04 '19 at 08:55
-
Okay does your player have a rigidbody? – Ali Kanat Apr 04 '19 at 08:56
-
Yeah it has and it’s enables – Alexander Udhude Apr 04 '19 at 08:57
-
Is it kinematic and are you using gravity? – Ali Kanat Apr 04 '19 at 08:59
-
No kinematic is off and gravity is on – Alexander Udhude Apr 04 '19 at 09:00
-
Do you have a thing like `isGrounded` is your character controller? Maybe you make a mistake there. Otherwise i don't see why it would not fall. – Ali Kanat Apr 04 '19 at 09:10
-
The only thing in my script is public Animator animator; Then a float variable public float InputX; Then I got the animator of the game object. Then this. input.getaxis”Horizontal”. Then the animator.Setfloat(“InputX” , InputX). I don’t have any of that in my script. Or does there need to be a collider on my player? – Alexander Udhude Apr 04 '19 at 09:19
-
Well you need to have a collider on your ground and on your player. Also apparently your animator is moving the player so it is most likely overriding the falling. – Ali Kanat Apr 04 '19 at 09:21
-
Lemme try that with a new scene – Alexander Udhude Apr 04 '19 at 09:43
-
1I guess it’s the controller script . Tried it with a cube as the player and just a box collider added to both the ground and player and it worked. I need to learn a new script of humanoid animator control script – Alexander Udhude Apr 05 '19 at 12:36