Documentation Index
Fetch the complete documentation index at: https://mintlify.com/OmarMtya/enginejs-module/llms.txt
Use this file to discover all available pages before exploring further.
Rigido is the physics component that opts a Figura into Engine.js’s gravity and collision system. Attaching a Rigido to a figure causes the animation loop to call afectarGravedad(), tocandoFondo(), and tocandoRigidos() on every frame. Without a Rigido, a figure is purely decorative and ignored by all physics calculations.
Constructor
new Rigido(valor = 9.8, sinColision = false)
Initial gravity speed in pixels per frame. Each frame that the figure is
airborne,
afectarGravedad() adds this value to transform.y and then
increases it by valor / (Environment.FPS * 100), producing smooth
acceleration. A value of 0 creates a figure that never falls and is useful
for static platforms.When
true, this figure falls under gravity but does not participate in
rigid-body collision resolution with other figures. It is excluded from the
figuras.filter() loop inside tocandoRigidos(), so other figures fall
through it. Useful for background objects or triggers that should not block
movement.Instance Properties
Current gravity speed in pixels per frame. Mutated each frame by
afectarGravedad(). After a collision transfers this speed to the struck
figure, it is reset to Environment.gravedad.A copy of the
valor passed to the constructor. Stored at construction time
and available for manual resets, but not used automatically by the engine in
the current version.true when this figure is currently resting on the floor (tocandoFondo())
or on top of another rigid figure (tocandoRigidos()). While true, the
animation loop skips afectarGravedad(). Set back to false as soon as the
figure leaves the surface.Collision passthrough flag. Mirrors the constructor parameter and can be
toggled at runtime to dynamically enable or disable collision resolution for
this figure.
Reserved field on
Rigido. Always null in the current version of Engine.js;
it is never assigned after construction. Do not confuse this with
Figura.tocadoPor, which is a separate property set directly on the
Figura instance by tocandoRigidos() when another figure lands on top of it.Internal one-tick flag. Set to
true by tocandoRigidos() at the moment
this figure’s gravity is reset after landing on another figure. On the
following tick, tocandoRigidos() reads this flag, sets it back to false,
and skips setting colision = false — preventing a one-frame flicker where
the figure would appear airborne immediately after impact.