I am making a 3D game in Ursina. But, if the player falls at a great enough height, it will just clip straight through the plane and fall into the void. I'm guessing it is because the player is falling so fast the game doesn't even realize the player collided with the ground. All I'm wondering is if there is a way to fix this.
Asked
Active
Viewed 313 times
1
-
1probably there is, e.g. reduce the initial height, reduce gravity, use a bigger collider, check the current height manually and adjust falling speed – Jan Wilamowski Apr 18 '22 at 04:48
-
@JanWilamowski how do i increase the size of the collider without increasing the size of the mesh itself? please explain. – Spiceinajar Apr 18 '22 at 11:57
-
I don't think that's possible with a mesh collider. My point is, you didn't specify your problem clearly and didn't provide any code in the form of a [minimal, reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) as well as the things you've tried so far. – Jan Wilamowski Apr 19 '22 at 00:48
-
@JanWilamowski there are not many details to give than i already have. you don't need code to understand what the problem is in this case. – Spiceinajar Apr 22 '22 at 14:45
-
StackOverflow is not a coding service. We do require you to show your code in order to provide a specific solution. You asked a vague question to which I gave vague answers. You might have more success with getting replies after reading throw [How to Ask](https://stackoverflow.com/help/how-to-ask). – Jan Wilamowski Apr 23 '22 at 07:31
-
Did you use a collider for the Entity you have to make collide with the player? – Tanay May 18 '22 at 11:17
-
Try to make the player drop from low height or make the gravity of player low . – Tanay May 18 '22 at 11:22
1 Answers
1
well you can define an update function and make an if condition inside to check if the player's y is lower than 100 then make player.gravity = -1 so that the player floats upwards and if the player.y is too high make player.gravity 1
Code explanation:
from ursina import *
from ursina.prefabs import FirstPersonController
app = Ursina()
player = FirstPersonController()
def update():
if player.y < 100:
player.gravity = -1
if player.y > 300:
player.gravity = 0.005
app.run()

Hacker
- 37
- 12
-
The problem with this is, the plane has a height map applied to it, which means that the y level across the plane is not constant. – Spiceinajar May 07 '22 at 12:05
-
ok well it worked for me it still went through the ground but it came back up too – Hacker May 08 '22 at 10:00
-
FPC uses raycast, it does not uses a physics library like bullet. The problem with this is that it may not detect the ground correctly, therefore the player may clip into the ground or even fall into the void. – Lixt Jan 09 '23 at 19:30