Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
esengine::ecs::CharacterController3D Struct Reference

A kinematic mover for a 3D player or NPC. More...

#include <RigidBody3D.hpp>

Public Attributes

glm::vec3 velocity {0.0f, 0.0f, 0.0f}
 Desired velocity in world units/second. A positive y is a jump.
f32 radius {30.0f}
 World units, as every length here: these defaults are a 1.6 m person at the reference scale of 100 units a metre, and scale with the project's units per metre (sdk ecs/worldUnits.ts). They read 0.3 / 0.5 before — metres, under a solver that reads centimetres by default, which made a 3 mm character.
f32 halfHeight {50.0f}
 Half the cylinder; total height is 2*(halfHeight + radius).
f32 maxSlope {0.87f}
 Steepest ground it can stand on. Beyond this it slides.
f32 stepHeight {40.0f}
 Tallest step it climbs instead of stopping at. 0 = climbs nothing.
f32 snapDown {50.0f}
 How far it reaches down to stay on the floor over a crest. 0 = off.
f32 mass {70.0f}
 Mass used when it pushes dynamic bodies.
f32 pushForce {5000.0f}
 How hard it can shove what it walks into, in newtons. A character is swept rather than solved, so nothing moves out of its way unless it is given the strength to move it — and the force a solver needs to get a crate going is well above the one that would hold it there. 0 pushes nothing at all.
bool enabled {true}
u32 layer {0}
 Which collision layer it is in (0..15).
bool isOnFloor {false}
 Output: standing on ground it can walk on.
glm::vec3 floorNormal {0.0f, 0.0f, 0.0f}
 Output: the floor's normal; zero while airborne.
glm::vec3 realVelocity {0.0f, 0.0f, 0.0f}
 Output: what it actually moved, per second, after collisions.

Detailed Description

A kinematic mover for a 3D player or NPC.

Swept against the world rather than solved in it, which is what lets it climb a step without inheriting the momentum of what it stands on. Set velocity each step; the vertical component is carried for you, so a zero there means "walk". REPLACES a RigidBody3D rather than joining one.

Definition at line 223 of file RigidBody3D.hpp.

Member Data Documentation

◆ enabled

bool esengine::ecs::CharacterController3D::enabled {true}

Definition at line 263 of file RigidBody3D.hpp.

Referenced by EMSCRIPTEN_BINDINGS().

◆ floorNormal

glm::vec3 esengine::ecs::CharacterController3D::floorNormal {0.0f, 0.0f, 0.0f}

Output: the floor's normal; zero while airborne.

Definition at line 275 of file RigidBody3D.hpp.

Referenced by EMSCRIPTEN_BINDINGS().

◆ halfHeight

f32 esengine::ecs::CharacterController3D::halfHeight {50.0f}

Half the cylinder; total height is 2*(halfHeight + radius).

Definition at line 236 of file RigidBody3D.hpp.

Referenced by EMSCRIPTEN_BINDINGS().

◆ isOnFloor

bool esengine::ecs::CharacterController3D::isOnFloor {false}

Output: standing on ground it can walk on.

Definition at line 271 of file RigidBody3D.hpp.

Referenced by EMSCRIPTEN_BINDINGS().

◆ layer

u32 esengine::ecs::CharacterController3D::layer {0}

Which collision layer it is in (0..15).

Definition at line 267 of file RigidBody3D.hpp.

Referenced by EMSCRIPTEN_BINDINGS().

◆ mass

f32 esengine::ecs::CharacterController3D::mass {70.0f}

Mass used when it pushes dynamic bodies.

Definition at line 252 of file RigidBody3D.hpp.

Referenced by EMSCRIPTEN_BINDINGS().

◆ maxSlope

f32 esengine::ecs::CharacterController3D::maxSlope {0.87f}

Steepest ground it can stand on. Beyond this it slides.

Definition at line 240 of file RigidBody3D.hpp.

Referenced by EMSCRIPTEN_BINDINGS().

◆ pushForce

f32 esengine::ecs::CharacterController3D::pushForce {5000.0f}

How hard it can shove what it walks into, in newtons. A character is swept rather than solved, so nothing moves out of its way unless it is given the strength to move it — and the force a solver needs to get a crate going is well above the one that would hold it there. 0 pushes nothing at all.

Definition at line 260 of file RigidBody3D.hpp.

Referenced by EMSCRIPTEN_BINDINGS().

◆ radius

f32 esengine::ecs::CharacterController3D::radius {30.0f}

World units, as every length here: these defaults are a 1.6 m person at the reference scale of 100 units a metre, and scale with the project's units per metre (sdk ecs/worldUnits.ts). They read 0.3 / 0.5 before — metres, under a solver that reads centimetres by default, which made a 3 mm character.

Definition at line 232 of file RigidBody3D.hpp.

Referenced by EMSCRIPTEN_BINDINGS().

◆ realVelocity

glm::vec3 esengine::ecs::CharacterController3D::realVelocity {0.0f, 0.0f, 0.0f}

Output: what it actually moved, per second, after collisions.

Definition at line 279 of file RigidBody3D.hpp.

Referenced by EMSCRIPTEN_BINDINGS().

◆ snapDown

f32 esengine::ecs::CharacterController3D::snapDown {50.0f}

How far it reaches down to stay on the floor over a crest. 0 = off.

Definition at line 248 of file RigidBody3D.hpp.

Referenced by EMSCRIPTEN_BINDINGS().

◆ stepHeight

f32 esengine::ecs::CharacterController3D::stepHeight {40.0f}

Tallest step it climbs instead of stopping at. 0 = climbs nothing.

Definition at line 244 of file RigidBody3D.hpp.

Referenced by EMSCRIPTEN_BINDINGS().

◆ velocity

glm::vec3 esengine::ecs::CharacterController3D::velocity {0.0f, 0.0f, 0.0f}

Desired velocity in world units/second. A positive y is a jump.

Definition at line 226 of file RigidBody3D.hpp.

Referenced by EMSCRIPTEN_BINDINGS().


The documentation for this struct was generated from the following file:
  • /home/runner/work/estella/estella/src/esengine/ecs/components/RigidBody3D.hpp