Skip to content

Latest commit

 

History

History
238 lines (235 loc) · 5.28 KB

FUNCTIONS.md

File metadata and controls

238 lines (235 loc) · 5.28 KB

Global fluid system functions

Function Definition Arguments Returns
fluidsystem.new Creates a new fluid system fluid parameter table (PARAMETERS.md) fluidsystem
fluidsystem.update Updates all fluid system simulations delta time nil
fluidsystem.draw Renders all fluid systems nil nil
fluidsystem.get Returns a reference to a specified fluid system id fluidsystem
fluidsystem.destroy Destroys a specified fluid system id nil
fluidsystem.assignBoxCollider Assigns a box collider to a specified object object, w, h, mass, static, ox, oy fluidcollider
fluidsystem.assignCircleCollider Assigns a circle collider to a specified object object, radius, mass, static, offset x, offset y fluidcollider
fluidsystem.assignPixelCollider Assigns a pixel collider to a specified object object, scale x, scale y, imagedata, mass, static, offset x, offset y fluidcollider
fluidsystem.boxCollision Performs a box collision test collider a, collider b boolean
fluidsystem.circleCollision Performs a circle collision test collider a, collider b boolean
fluidsystem.pixelCollision Performs a pixel collision test collider a, collider b boolean
fluidsystem.boxResolution Resolves collision for a box collider collider a, collider b, friction, damping nil
fluidsystem.innerBoxResolution Resolves collision for the inside edges of a box collider collider a, collider b, friction nil
fluidsystem.circleResolution Resolves collision for a circle collider collider a, collider b, damping float, float
fluidsystem.pixelResolution Resolves collision for a pixel collider collider a, collider b nil
fluidsystem.confineResolution Confines a collider in a given area collider, friction, x, y, width, height nil

The collision functions have not been completely documented yet. There is commented guide to using these in the fluidsystem.lua file.

Local fluid system methods

Function Definition Arguments Returns
system:addParticle Creates a new particle x, y, velocity x, velocity y, color, radius, mass particle
system:removeParticle Removes a particle from a system id nil
system:removeAllParticles Removes all particles in a system nil nil
system:returnParticleCount Returns the sum of particles in a system nil int
system:applyImpulse Applies an impulse to all particles in a system x, y, force, radius nil
system:addAffector Creates a new force affect in a system x, y, force, radius affector
system:removeAffector Removes an affector from a system id nil
system:removeAllAffectors Removes all affectors from a system nil nil
system:returnAffectorCount Returns the sum of affectors in a system nil int
system:addCollider Assigns a new fluid collider to a system collider collider
system:removeCollider Removes a collider from a system collider nil
system:removeAllColliders Removes all colliders from a system nil nil
system:returnColliderCount Returns the sum of colliders in a system nil int
system:newQuad Generates a new quad for the system's quadtree x, y, width, height, level, parent quad quad
system:updateQuadtreeCollider Validates a collider for the quadtree collider nil
system:constructVectorTable Takes in a table and filters out the x and y variables into a new table table table
system:generateFluidshader Generates a system's fluidshader nil nil
system:updateFluidshader Updates a system's fluidshader nil nil
system:simulate Calculates a frame of a system's simulation delta time nil
system:draw Draws a frame of a system's simulation nil nil