2D Physics Simulator |
||
Show controls directives
|
About this :
A light 2D physics interactive simulator based upon nodes and constraints.Engine developped in javascript by Nicolas Tambon. Project shared on SourceForge. Development : Dec 2013 | Released on Chrome experiments : March 18, 2014 Help for editor :
Scenarii can be live modified and run within the editor. Editor accepts plain javascript code. Available functions for easy sandboxing the engine are described below.You may read the existing preset scenarii for use examples. Physics functions :
nodeId addNode(int x, int y, int radius, int weight) creates a node. It returns the id of the node created, that can be used for connecting constraints. If weight is set to 0, the node won't be under influence of gravity nor other nodes.void addConstraint(nodeId from, nodeId to, int distance, bool reciprocity) creates a constraint between 2 nodes of the distance defined. By default, a constraint is not reciprocal. You can then create blackholes, or even a virtual force by constraining 2 nodes with different distances. void breakConstraints(array constraintsIndexes) deletes the constraints indexes. Controls directives :
These directives allow you to change control panel values before launching your script.setViscosityControl(int viscosityValue) setGravityControl(bool activate, int gravityForce) setHullControl(bool activate, bool activateSmoothHullBorder) setDisplayNodesControl(bool activate, int newNodesRadius) setCollisionsControl(bool activate, [optional] repulsion strength) setConstraintsControl(bool activate, bool showSkeleton,int looseness, [optional] breakingRatio) |
Developped and awesomized by Nicolas Tambon
|