Added terrain and first person controller.
This commit is contained in:
parent
819c4a3c70
commit
9d73c38597
BIN
images/pic1.png
BIN
images/pic1.png
Binary file not shown.
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 103 KiB |
3
src/meshes/__init__.py
Normal file
3
src/meshes/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
"""
|
||||
Module
|
||||
"""
|
17
src/meshes/terrain.py
Normal file
17
src/meshes/terrain.py
Normal 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'
|
@ -2,17 +2,22 @@
|
||||
|
||||
# Lib imports
|
||||
from ursina import *
|
||||
from ursina.prefabs.first_person_controller import FirstPersonController
|
||||
|
||||
# Application imports
|
||||
from meshes.terrain import TerrainMesh
|
||||
|
||||
|
||||
class World():
|
||||
""" docstring for World. """
|
||||
|
||||
def __init__(self):
|
||||
Sky()
|
||||
FirstPersonController()
|
||||
TerrainMesh()
|
||||
|
||||
self.cube = Entity(model='cube', color=hsv(300,1,1), scale=2, collider='box')
|
||||
self.cube.on_click = self.spin
|
||||
EditorCamera() # add camera controls for orbiting and moving the camera
|
||||
|
||||
def spin(self):
|
||||
self.cube.animate('rotation_y', self.cube.rotation_y+360, duration=2, curve=curve.in_out_expo)
|
||||
|
Loading…
Reference in New Issue
Block a user