CoSpaces Edu scripting API - Version 2021.03
CoSpaces Edu supports scripting for creating advanced, interactive experiences!
Changes in 2021.03
- Updated wording
Getting started
To add scripts to your Scene, click the Code - button in the toolbar and select script. To run your scripts, press the Play - button in the toolbar.
- Scripts run in the scripting tab order in which they were added in (left to right).
- Update loops can be defined with time methods.
Working with items
Items in CoSpaces Edu are categorized by different interfaces based on functionality. BaseItem is the base item class which exposes core item functionality. Child interfaces such as the AnimatedItem add additional methods and properties.
- To get items in a scene, use scene.getItem
- To get items and cast them to their correct item class, use the "Get item" button in the Code dropdown of the item inspector
Event handlers
Event handlers allow you to create triggers for inputs, collisions, and application states. Most handlers are unique; creating a new event handler of the same kind causes the previous one to be disposed.
You can create event handlers for
- input actions
- application states
- BaseItem collisions and inputs
Namespaces
Classes
-
AnimatedItem -
BaseItem -
CameraItem -
Capsule -
Color -
Cone -
ConeFrustum -
Cuboid -
Cylinder -
Ellipsoid -
EllipsoidItemBase -
FigureItem -
Frustum -
Frustum4 -
HemiEllipsoid -
ItemCollection -
MediaItem -
PathItem -
Quat -
ReadonlyTransform -
SemiTorus -
Slot -
Sound -
Text3DItem -
TextItem -
Torus -
TorusItemBase -
Transform -
Tube -
Tweener -
Vector3 -
VerticesItem -
Video -
VideoItem