We will now add another component to create a transform. Create a new script called Transform. py and add the following code:
import pygame
class Transform:
def_init_(self, position):
self.set_position(position)
def get_position(self) :
return self.position
def set_position(self, position) :
self.position $=$ pygame. math.Vector3 (position)
This component defines the object's location in 3D space. Notice the use of the Pygame Vector3 class. You will be seeing this a lot. Besides other things, this class stores a tuple in the form of $x, y$, and $z$. This makes the code more intuitive to read.