1

I'm making a grid and when it starts the grid is not in the middle so I camera. position but every time I write camera in my script even though it's the camera.position, camera. rotation and I start the script, there's nothing so please find out what's wrong here is the script `

class Game(Ursina):
  def __init__(self):
    super().__init__()
    window.color = color.black
    window.fullscreen_size = 1920, 1080
    window.fullscreen = True
    Light(type='ambient', color=(0.5, 0.5, 0.5, 1))
    Light(type='directional', color=(0.5, 0.5, 0.5, 1), direction=(1, 1, 1))
    self.MAP_SIZE = 20
    self.new_game()
    camera.position = ()
    camera.rotation_x = 57

 def create_map(self, MAP_SIZE):
    Entity(model='quad', scale=MAP_SIZE, position=(MAP_SIZE // 2, MAP_SIZE // 2, 0), color=color.dark_gray)
    Entity(model=Grid(MAP_SIZE, MAP_SIZE), scale=MAP_SIZE, position=(MAP_SIZE // 2, MAP_SIZE // 2, -0.01), color=color.white)


 def new_game(self):
    self.create_map(self.MAP_SIZE)
 def input(self, key):
    super().input(key)

 def update(self):
    pass
    

if __name__ == '__main__':
game = Game()
Update = game.update
game.run()
Demo Nomp
  • 43
  • 4

1 Answers1

0

camera.rotation_x = 57 rotates the camera 57 degrees forward, so it's looking down. Entity(model='quad') is centered by default, so you don't have to do anything to center it. Simply don't rotate or move the camera or the entities and everything will be centered.

pokepetter
  • 1,383
  • 5
  • 8