Skip to content

Instantly share code, notes, and snippets.

Created April 26, 2015 20:21
What would you like to do?
Example use of a screen-wide fluid to create global drag for nape bodies
var screenShape = new Polygon(Polygon.rect(0, 0, Luxe.screen.w, Luxe.screen.h, true));
screenShape.fluidEnabled = true;
//Density of 0.3, Viscosity of 3. These are values you just have to experiment with until it feels right
screenShape.fluidProperties = new FluidProperties(0.3, 3);
//It's important to set the collisionMask (second parameter) to 0 here,
//so the shape doesn't collide with anything (we want everything to just move through it)
screenShape.filter = new InteractionFilter(1, 0);
//Set up a body holding the shape and add it to the space
var screenBody = new Body(BodyType.STATIC);
screenBody.shapes.add(screenShape); =;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment