Prepare
Magic Leap One
https://www.magicleap.com/magic-leap-one
mlsdk v.0.20.0
https://creator.magicleap.com/downloads/lumin-sdk/overview
magic-script-cli v2.0.1
https://www.npmjs.com/package/magic-script-cli
PopcornFX 1.12.x editor (Latest)
https://wiki.popcornfx.com/index.php/PK-Editor_v1.12
Create Particle Package
No.1
TutorialParticles Download & Create New.
Project Name (Folder Name) : Project01.
No.2
Import.
No.3
Open Project01
No.4
Menu: Edit -> Project Settings.
No.5
Assets->Baking
Enter the Baking Root folder name.
Click New button.
OK
No.6
After selecting Smoke 02, Bake.
Bake Settings
No.7
Bake complete. Load the project created in the BAKE folder from the application and use it.
Create Project
magic-script init my-particle org.magicscript.particle "Particle"
cd my-particle
mkdir res
Place the Project 01 created in the BAKE folder in the res folder.
Code
Change app.package
DATAS = "digest.sha512.signed" : "." \
"bin/" : "bin/" \
"res/" : "res/"
OPTIONS = package/minApiLevel/2
Change app.js
import {
LandscapeApp
, ui} from 'lumin';
const { UiButton } = ui;
export class App extends LandscapeApp {
onAppStart () {
let isPlay = false;
const prism = this.requestNewPrism([1.0, 3.0, 1.0]);
const res = prism.createParticlePackageResourceId(
"res/Project01");
const p = prism.createParticleNode(res);
p.setEffectName("Particles/Smoke02.pkfx");
p.setLocalPosition([0, -0.5, -0.4]);
const button = UiButton.Create(prism, 'Play', 0, 0.1);
button.onActivateSub(function (uiEventData) {
if (isPlay)
{
p.stop();
button.setText("Play");
}
else
{
p.play();
button.setText("Stop");
}
isPlay = !isPlay;
});
prism.getRootNode().addChild(button);
prism.getRootNode().addChild(p);
}
}
Build
magic-script build -i
Run
magic-script run --port=10000
Reference
ParticleNode(Magic Script API Doc)
https://docs.magicscript.org/lumin.ParticleNode.html
magicscript
https://www.magicscript.org/
Thanks!