if __name__ == '__main__': from ursina import * from ursina.prefabs.primitives import * # window.size *= .5 app = Ursina() shader = lit_with_shadows_shader a = Entity(model='cube', shader=shader, texture='radial_gradient', color=color.red) # a.set_shader_input('texture_scale', 2) # b = WhiteSphere(shader=shader, rotation_y=180, x=3, texture='brick') # b.texture.filtering = None GrayPlane(scale=10, y=-2, texture='shore', shader=shader) # Enable shadows; we need to set a frustum for that. from ursina.lights import DirectionalLight sun = DirectionalLight(y=10, rotation=(90+30,90,0)) sun._light.show_frustum() Sky(color=color.light_gray) EditorCamera() def update(): a.x += (held_keys['d'] - held_keys['a']) * time.dt * 5 a.y += (held_keys['e'] - held_keys['q']) * time.dt * 5 a.z += (held_keys['w'] - held_keys['s']) * time.dt * 5 app.run()
#window.debug_menu.enabled = False window.size=(width,height) #Light(type='ambient', color=(0.3,0.3,0.3,1), direction=(1,1,1)) #ground = Entity(model='plane',shader=lit_with_shadows_shader, texture='white_cube',scale=(32,1,32),texture_scale=(32,32), collider='mesh',color=color.white) ground = Entity(model='plane', texture='road',scale=(1000,1,1000), texture_scale=(500,500), collider='box')#,shader=lit_with_shadows_shader) #ground = Entity(model='plane', scale=(20,1,20),texture_scale=(200,200), texture='road', collider='box') sun = DirectionalLight(y=10, rotation=(160,90,0)) #sun._light.show_frustum() Sky(color=color.rgb(200,200, 220, a=255) ) #player = FirstPersonController(model='cube', y=1, origin_y=-.5) player=CarController(y=10,x=2) def update(): pass app.run()
) if __name__ == '__main__': from ursina import * app = Ursina() shader = lit_with_shadows_shader a = Entity(model='cube', shader=shader, y=1, color=color.light_gray) Entity(model='sphere', texture='shore', y=2, x=1, shader=shader) Entity(model='plane', scale=16, texture='grass', shader=lit_with_shadows_shader) from ursina.lights import DirectionalLight sun = DirectionalLight(shadow_map_resolution=(2048,2048)) sun.look_at(Vec3(-1,-1,-10)) # sun._light.show_frustum() scene.fog_density = (1, 50) Sky(color=color.light_gray) EditorCamera() def update(): a.x += (held_keys['d'] - held_keys['a']) * time.dt * 5 a.y += (held_keys['e'] - held_keys['q']) * time.dt * 5 a.z += (held_keys['w'] - held_keys['s']) * time.dt * 5 def input(key): if key == 'r': if sun.color == color.white: sun.color = color.red