Objects::GameObject

GameObject in Unified Engine

The GameObject class represents individual entities within the Unified Engine. It acts as the primary way to manage in-game items, characters, or other interactive entities. Every GameObject in the engine can have a visual representation defined by its Mesh, and it also can have various behaviors defined by components.

Class Components

Protected Members:

  • VAO, VBO, EBO: Buffers used for storing vertex data for rendering the GameObject.

  • mesh: Represents the shape and layout of the object.

  • ModelMatrix: Represents the object's position, rotation, and scale in 3D space.

  • GenerateVAOBuffers(): Function to initialize and bind vertex data to GPU buffers.

  • NoShader: A flag to check if the object has an associated shader.

  • transformOld: Stores the previous state of the GameObject's transformation.

Public Members:

  • transform: Represents the current position, rotation, and scale of the GameObject.

  • Name: A name for the GameObject.

  • Tag: A tag for additional categorization or identification.

  • shader: Points to the ShaderObject that the GameObject uses for rendering.

Constructors & Destructor:

  • GameObject(Mesh _mesh, ShaderObject* _shader): Constructs a GameObject with a specified Mesh and ShaderObject.

  • GameObject(GameObject* _parent, Mesh _mesh, ShaderObject* _shader): Constructs a GameObject with a parent, a specified Mesh, and a ShaderObject.

  • ~GameObject(): Destructor for the GameObject object.

Methods:

  • Update(): Method to update the GameObject's state each frame.

  • Render(): Method to render the GameObject to the screen.

Last updated