List Objects - ZackWilde27/Z3dPy GitHub Wiki

For the most speed, the smaller objects are lists instead of classes.

Most list objects have functions to make setting and retrieving properties easier.

Vector

a simple Vector3

[0] is x

[1] is y

[2] is z

myVector = [1.0, 2.0, 3.0]

Vector2

2D Vector used for UVs

[0] is x

[1] is y

myVector2 = [1.0, 2.0]

Vector4

A Vector with a w component for matrix math.

[0] is x

[1] is y

[2] is z

[3] is w

myVector4 = [1.0, 2.0, 3.0, 1.0]

VectorUV

A Vector with UVs and normals. These are the vectors used in Tris.

[0] is x

[1] is y

[2] is z

[3] is the normal

[4] is UV

myVectorUV = [1.0, 2.0, 3.0, [4.0, 5.0, 6.0], [7.0, 8.0]]

Tri

A Triangle, with some extra information stored for convenience.

[-1] is the user variable

[0] - [2] are the three points, stored as VectorUVs

[3] is the stored normal, by default it's in world space.

[4] is the centre point in world space

[5] is the baked shade, re-used for lighting with MATERIAL_STATIC or SHADER_STATIC

[6] is the colour, determined by the material of the mesh it came from.

[7] is the id, determined by the mesh it came from

myTri = [1.0, 2.0, 3.0 [4.0, 5.0, 6.0], [7.0, 8.0](/ZackWilde27/Z3dPy/wiki/1.0,-2.0,-3.0-[4.0,-5.0,-6.0],-[7.0,-8.0), [1.0, 2.0, 3.0, [4.0, 5.0, 6.0], [7.0, 8.0]], [1.0, 2.0, 3.0, [4.0, 5.0, 6.0], [7.0, 8.0]], [1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0], [1.0, 2.0, 3.0], 4, None]


# Tri functions
z3dpy.TriGetP1(myTri)
z3dpy.TriGetP2(myTri)
z3dpy.TriGetP3(myTri)

z3dpy.TriGetNormal(myTri)
z3dpy.TriSetNormal(myTri, [1.0, 2.0, 3.0])

z3dpy.TriGetWPos(myTri)
z3dpy.TriSetWPos(myTri)

z3dpy.TriGetColour(tri)
z3dpy.TriSetColour(tri, [1, 2, 255])

z3dpy.TriGetShade(tri)
z3dpy.TriSetShade(tri, [1.0, 2.0, 3.0])

z3dpy.TriGetId(tri)
z3dpy.TriSetId(tri, 1)

Particle

Particles stored in emitters

[0] is the time left for the particle

[1] is the position

[2] is the velocity

myParticle = [1.0, [2.0, 3.0, 4.0], [5.0, 6.0, 7.0]]

# Particle functions
z3dpy.PartGetTime(myParticle)
z3dpy.PartSetTime(myParticle)

z3dpy.PartGetPos(myParticle)
z3dpy.PartSetPos(myParticle)

z3dpy.PartGetVelocity(particle)
z3dpy.PartSetVelocity(particle)

Ray

Used for debugging, and collisions

[-1] is the user variable

[0] is whether or not to draw as an arrow.

[1] is the start position

[2] is the end position

myRay = [False, [1.0, 2.0, 3.0], [4.0, 5.0, 6.0], None]

# Ray Functions
z3dpy.RayGetStart(ray)
z3dpy.RaySetStart(ray, [1.0, 2.0, 3.0])

z3dpy.RayGetDirection(ray)
z3dpy.RayGetLength(ray)

z3dpy.RayGetEnd(ray)
z3dpy.RaySetEnd(ray, [1.0, 2.0, 3.0])

z3dpy.RayGetIsArrow(ray)
z3pdy.RaySetIsArrow(ray, True)

Hits

Returned by ray intersection functions

[0] is whether or not it hit

and if so...

[1] is the location of the hit

[2] is the distance along the ray of the hit

[3] is the triangle that was hit

myHit = [True, [1.0, 2.0, 3.0], 250.0, Tri]

# Hit Functions
z3dpy.HitCheck(hit)

z3dpy.HitGetDistance(hit)

z3dpy.HitGetPos(hit)

z3dpy.HitGetTri(hit)