'Ursina player keeps clipping through ground
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.
Solution 1:[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()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |