terraincast
</> ursina.terraincast
Variables
.helper
default: None
Functions
terraincast()
terraincast(world_position=None, terrain_entity=None, height_values=None, return_normals=False)
uses x and z to return y on terrain.
Examples
app = Ursina()
terrain_entity = Entity(model=Terrain('heightmap_1', skip=8), scale=(40, 5, 20), texture='heightmap_1')
player = Entity(model='sphere', color=color.azure, scale=.2, origin_y=-.5)
hv = terrain_entity.model.height_values
def update():
direction = Vec3(held_keys['d'] - held_keys['a'], 0, held_keys['w'] - held_keys['s']).normalized()
player.position += direction * time.dt * 4
y = terraincast(player.world_position, terrain_entity, hv)
if y is not None:
player.y = y
EditorCamera()
Sky()
app.run()