matrix-engine
Version:
DISABLE RAYCAST DEBUG TEST [2.3.3] Fix for GUI win desktop [2.3.0] DestrucMesh solution & loading convex objs for physics BASIC, SpriteAnimation CPU/texture solution added, Improved notify box UI. Test netPos Offset ; dispatchEvent(new CustomEvent(net-rea
32 lines (24 loc) • 839 B
JavaScript
/**
*@Author Nikola Lukic
*@Description Matrix Engine Api Example
* Adding default color cube.
*/
/* globals world App */
import App from "../program/manifest";
export var runThis = (world) => {
world.Add("cube", 1, "MyColoredCube1");
world.Add("cube", 1, "MyColoredCube2");
world.Add("cube", 1, "MyColoredCube3");
canvas.addEventListener('mousedown', (ev) => {
matrixEngine.raycaster.checkingProcedure(ev);
});
addEventListener("ray.hit.event", function(e) {
console.info(e.detail);
});
App.scene.MyColoredCube1.position.SetX(0);
App.scene.MyColoredCube2.position.SetX(-2.5);
App.scene.MyColoredCube3.position.SetX(2.5);
App.scene.MyColoredCube1.rotation.rotationSpeed.x = 15;
App.scene.MyColoredCube2.rotation.rotationSpeed.y = 15;
App.scene.MyColoredCube3.rotation.rotationSpeed.z = 15;
};