pokepetter / ursina

A game engine powered by python and panda3d.
https://pokepetter.github.io/ursina/
MIT License
2.13k stars 321 forks source link

Create triangle.py #664

Closed Creator754915 closed 3 months ago

Creator754915 commented 3 months ago

Triangle model without 3d model import.

You can:

  1. Ajust the size
  2. The color
  3. And all same a Entity

Thanks !

image

image

pokepetter commented 3 months ago

There's no reason for this to be a class. It could be a Mesh. There's no reason to create three Entities for each corner. There's no reason to have size, since you can just scale the Entity. There's no reason to make yet another Entity to make the model. What I would do I wanted a triangle would be to make a triangle.ursinamesh file with hard coded values and do

my_triangle = Entity(model='triangle')

It's also possible to make the Mesh in code, assign to a variable triangle_model, and do Entity(model=copy(triangle_model))