class documentation
class Sprite3D(engine.Sprite3D):
Represent a native 3D sprite made from triangles.
Methods
- add_triangle(
x1,y1,z1,x2,y2,z2,x3,y3,z3, color=0x0000, wireframe=True) - Add a triangle to the sprite.
- add_triangle(
- get_triangle(
index) - Return a Triangle3D object.
- get_triangle(
- update_triangle(
index,x1,y1,z1,x2,y2,z2,x3,y3,z3, color=0x0000, wireframe=True) - Replace one triangle.
- update_triangle(
- clear_triangles()
- Remove all triangles from the sprite.
- create_humanoid(height=1.8, color=0x0000)
- Create a humanoid mesh.
- create_tree(height=2.0, color=0x0000)
- Create a tree mesh.
- create_house(width=2.0, height=2.5, color=0x0000)
- Create a house mesh.
- create_pillar(height=3.0, radius=0.3, color=0x0000)
- Create a pillar mesh.
- create_wall(
x,y,z, width=4.0, height=1.5, depth=0.2, color=0x0000) - Create a wall mesh.
- create_wall(
- create_cube(
x,y,z,width,height,depth, color=0x0000) - Create a cube mesh.
- create_cube(
- create_cylinder(
x,y,z,radius,height,segments, color=0x0000) - Create a cylinder mesh.
- create_cylinder(
- create_sphere(
x,y,z,radius,segments, color=0x0000) - Create a sphere mesh.
- create_sphere(
- create_triangular_prism(
x,y,z,width,height,depth, color=0x0000) - Create a triangular prism mesh.
- create_triangular_prism(
- initialize_as_house(
position,width,height,rotation, color=0x0000) - Initialize a house at a position.
- initialize_as_house(
- initialize_as_humanoid(
position,height,rotation, color=0x0000) - Initialize a humanoid at a position.
- initialize_as_humanoid(
- initialize_as_pillar(
position,height,radius, color=0x0000) - Initialize a pillar at a position.
- initialize_as_pillar(
- initialize_as_tree(
position,height, color=0x0000) - Initialize a tree at a position.
- initialize_as_tree(
- set_position(
position) - Set the sprite position.
- set_position(
- set_rotation_y(
rotation_y) - Set the Y-axis rotation.
- set_rotation_y(
- set_scale(
scale_factor) - Set the sprite scale.
- set_scale(
- set_active(
active) - Set whether the sprite is active.
- set_active(
- set_wireframe(
wireframe) - Set wireframe rendering for the mesh.
- set_wireframe(
- from_path(
path, wireframe=True) - Load a sprite mesh from a file.
- from_path(
- to_path(
path) - Save the sprite mesh to a file.
- to_path(
- bake_transform()
- Apply rotation and scale to stored triangles.
- __del__()
- Release the native sprite resources.
| Method | __setattr__ |
Set a sprite attribute, routing to the matching setter. |
| Instance Variable | active |
Whether the sprite is active. Writable. |
| Instance Variable | MAX |
Maximum supported triangle count. |
| Instance Variable | position |
Sprite position. Writable. |
| Instance Variable | rotation |
Rotation around the Y axis. Writable. |
| Instance Variable | scale |
Sprite scale factor. Writable. |
| Instance Variable | SPRITE |
Custom sprite type. |
| Instance Variable | SPRITE |
House sprite type. |
| Instance Variable | SPRITE |
Humanoid sprite type. |
| Instance Variable | SPRITE |
Pillar sprite type. |
| Instance Variable | SPRITE |
Tree sprite type. |
| Instance Variable | triangle |
Number of triangles in the sprite. Read-only. |
| Instance Variable | type |
Sprite type constant. Read-only. |