Today I wanted to add simple colliders to the GameObjects...However they would require a transform, and the GameObjects class already have transform informations...so does ligths, so I decided to do a big refactoring to create a system similar to the Unity one.
A GameObjects is the root object, and its behaviour is defined by its components, as in a slightly simplified composite pattern.
The refactoring took a lot of time, because lots of classes were dependent on lights or models information, while now they are dependent only on GameObjects.
Now each GameObject has 5 components: a Transform, a Model, and the three types of lights.
None of these, except the Transform, is mandatory. An object could choose to have it or not.
Directional lights are now multiple like point and spot lights, while before I could only have one.
In the picture there is an example of how the system is still working exacly like before.
I moved the boundaries of the physics to match the walls positions.
Hopefully the next screen of the engine will be exactly identical, but with real collisions with AABBs (Axis aligned bounding boxes).
The RigidBody class will be a component of the GameObject as well. If missing, the object will not interact with the physics simulation.

Nessun commento:
Posta un commento