Fandom

SketchyPhysicsWiki

Events

103pages on
this wiki
Add New Page
Talk0 Share

IntroductionEdit

SketchyPhysics 3.1 added a new resource: events. With events you can know when the user clicks on an object and when the simulation ends. You can set procedures for each event. The events are described below:

  • ontouch - Event is triggered when body is touched by another.
  • ontouching - Event is triggered every tick as long as bodies are in contact.
  • onuntouch - Event is triggered when bodies stop touching.
  • onstart - Event is triggered once at the beginning of the simulation.
  • onend - Event is triggered once at the end of the simulation.
  • onpreframe - Event is called at the beginning of each frame.
  • ontick - Event is once per frame just before the physics simulation step.
  • onpostframe - Event is called at the end of each frame after the physics simulation step.
  • onclick - Event is called when the user mouse clicks a body.
  • ondrag - Event is called each frame the user holds the mouse button after clicking.
  • onunclick - Event is called when the user releases the mouse button after clicking.

To add procedures to these events, you have to enable the "Scripting" box, below the "onTick" box, in the "UI Settings" window.

SyntaxEdit

ontouch{ # procedure here }

You have to put the code into the "scripting" box.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.