Beta 1.1.2: Animations, 2D Particles & 3D Physics Enhancements

There has been a period of silence around the project for some time, but that doesn’t mean nothing has happened during this time. With Update 0.1.1.2, some interesting features are introduced into the engine.

2D Particle Emitter

Firstly, there’s a new element called Particle Emitter, which as the name suggests, generates and manages particles. The particle emitter utilizes instanced rendering, which means that with just one draw call, up to 1000 or even more particles can be rendered, each differing in position, size, rotation, and color. Additionally, particles can be provided with alpha textures, allowing for individual customization of their shape.

C#
ParticleEmitter particles = new ParticleEmitter("Particles", new Vec3(10, 100, 0), Vec3.Zero(), new Vec3(40, 40), m_game.AssetManager.GetTexture("5.png"));
particles.ParticleDistance = 150;
particles.CreateParticles(50, new Vec3(15, 15));
scene.AddGameElement("ObjectsLayer", particles);

Animations with the Model Element

  • Show Model documentation

However, perhaps the most interesting feature is 3D animations. Previously, it was possible to render 3D models with the Element3D element. However, these models were always static, and yes, it wasn’t possible to create a 3D game with GFX until now. With this update, the foundation has been laid for creating 3D games. For this purpose, another element has been added, the Model. The Model element can currently only be used for 3D models that have a rig and animations. For static elements that do not have these, the Element3D can still be used. However, with a later update, it will also be possible to display models without a rig and animations using it.

C#
var model = new Model("Vampire", new Vec3(-1f, -1f, -1f), modelspath + "\\Vampire\\vampire.dae");
model.AnimationSpeed = 0.02f;
model.Size = new Vec3(0.7f);
model.PlayAnimation("");
baseScene.AddGameElement("BaseLayer", model);

Third-Person Character Controller & Physics

Docs: Class ThirdpersonCharacterController | GFX (676-games.de) Now that it’s possible to play animations, it should also be possible to move through the scene with a character. Therefore, I have added the ThirdPersonController as a behavior. During this, I noticed some bugs in the 3D physics, which I have fixed.

C#
Model model = new Model("Character", new Vec3(2f, 2f, 0f), modelspath + "\\Assets\\Animation\\Human.fbx");
model.PlayAnimation("Armature|idle");
scene.AddGameElement("BaseLayer", model);

var controller = model.AddBehavior(new Genesis.Core.Behaviors._3D.ThirdpersonCharacterController());
controller.CreatePhysics(physicsHandler, new Vec3(0f, 0.75f, 0f), 0.5f, 0.5f, 50f);
controller.RunAnimation = "Armature|run";
controller.IdleAnimation = "Armature|idle";

Leave a Reply

Your email address will not be published. Required fields are marked *