All examples By author By category About

cool-Blue

Pixi.js WebGL using spritesheet with colision physics

Rendering test with collision detection

Features

  1. Collisions between nodes
    Based on this example but enhanced to accurately model relative "mass" the rebound velocities are solved for using the equations for conservation of momentum and conservation of energy. The "efficiency" of the collisions - as defined by the ratio of the actual final velocities divided by the ideal, perfectly elastic system - is set internally.

  2. Boundary constraints and collisions
    This behaviour is also included in the gravity function and uses basic geometry to reflect the incident velocity in the plane of the boundary. It does this by using the Node velocity API to manipulate the d.px and d.py values of the nodes. It is possible, however, for nodes to penetrate the boundaries due to limitations in the temporal resolution of the layout.

  3. Recovering escaped nodes
    If a node escapes the boundaries of the bounding box, the velocity is still reflected in the plane of the penetrated boundary. If the escaped node's normal velocity component is zero then the node is steered back toward the boundary, with constant speed.

Other endering experiments with Pixi.js

  1. WebGL renderer with texture atlas (spritesheet)
  2. Canvas renderer with texture atlas (spritesheet)
  3. WebGL renderer with multiple sprites
  4. Canvas renderer with multiple sprites
  5. SVG