Added terrain and first person controller.

This commit is contained in:
itdominator 2022-11-12 22:45:29 -06:00
parent 819c4a3c70
commit 9d73c38597
4 changed files with 26 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 103 KiB

3
src/meshes/__init__.py Normal file
View File

@ -0,0 +1,3 @@
"""
Module
"""

17
src/meshes/terrain.py Normal file
View File

@ -0,0 +1,17 @@
# Python imports
# Lib imports
from ursina import *
# Application imports
class TerrainMesh(Entity):
""" docstring for TerrainMesh. """
def __init__(self):
super(TerrainMesh, self).__init__()
self.model = Terrain('heightmap_1', skip=8)
self.scale = (40, 5, 20)
self.texture = 'heightmap_1'

View File

@ -2,17 +2,22 @@
# Lib imports # Lib imports
from ursina import * from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
# Application imports # Application imports
from meshes.terrain import TerrainMesh
class World(): class World():
""" docstring for World. """ """ docstring for World. """
def __init__(self): def __init__(self):
Sky()
FirstPersonController()
TerrainMesh()
self.cube = Entity(model='cube', color=hsv(300,1,1), scale=2, collider='box') self.cube = Entity(model='cube', color=hsv(300,1,1), scale=2, collider='box')
self.cube.on_click = self.spin self.cube.on_click = self.spin
EditorCamera() # add camera controls for orbiting and moving the camera
def spin(self): def spin(self):
self.cube.animate('rotation_y', self.cube.rotation_y+360, duration=2, curve=curve.in_out_expo) self.cube.animate('rotation_y', self.cube.rotation_y+360, duration=2, curve=curve.in_out_expo)