Module libre_pvz::core::kinematics
source · Expand description
Kinematics for projectiles and other movable entities.
All the movable entities live in a right-handed pseudo-3D world. The XY plane lies on the ground, with the X axis points right, and the Y axis points up. The Z axis is for height, and coincides with Y axis on the viewport. This coordinate system has the following benefits:
- it easily translates to the viewport coordinate (
x <- x
,y <- y + z
); - it avoids false collision (it distinguishes between “at the back” and “high in the sky”);
- it allows objects to correctly drop their shadows;
All entities have a planar collide box in the 2D world. During collision detection, the collide boxes are laid out parallel to the XZ plane, and then pushed along the Y axis to form a cuboid.
Structs§
- Acceleration (in length per square second).
- Kinematics plugin for all movable entities.
- Position.
- Velocity (in length per second).
Enums§
- System label for kinetics systems.
Functions§
- Update velocity from acceleration.
- Coordinate translation from pseudo 3D to 2D.
- Update position from velocity.