mirror of
https://github.com/overte-org/overte.git
synced 2025-08-15 14:09:51 +02:00
example of setting particle model with JS
This commit is contained in:
parent
427abd4509
commit
bd0631838d
1 changed files with 49 additions and 0 deletions
49
examples/particleModelExample.js
Normal file
49
examples/particleModelExample.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
//
|
||||
// particleModelExample.js
|
||||
// hifi
|
||||
//
|
||||
// Created by Brad Hefta-Gaub on 1/28/14.
|
||||
// Copyright (c) 2014 HighFidelity, Inc. All rights reserved.
|
||||
//
|
||||
// This is an example script that demonstrates creating and editing a particle
|
||||
//
|
||||
|
||||
var count = 0;
|
||||
var stopAfter = 100;
|
||||
|
||||
var modelProperties = {
|
||||
position: { x: 0, y: 1, z: 0 },
|
||||
velocity: { x: 0.5, y: 0, z: 0.5 },
|
||||
gravity: { x: 0, y: 0, z: 0 },
|
||||
damping: 0,
|
||||
radius : 0.1,
|
||||
modelURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/Feisar_Ship.FBX",
|
||||
};
|
||||
|
||||
var ballProperties = {
|
||||
position: { x: 0, y: 0.75, z: 0 },
|
||||
velocity: { x: 0.5, y: 0, z: 0.5 },
|
||||
gravity: { x: 0, y: 0, z: 0 },
|
||||
damping: 0,
|
||||
radius : 0.1,
|
||||
color: { red: 255, green: 0, blue: 0 },
|
||||
};
|
||||
|
||||
var modelParticleID = Particles.addParticle(modelProperties);
|
||||
var ballParticleID = Particles.addParticle(ballProperties);
|
||||
|
||||
function endAfterAWhile() {
|
||||
// stop it...
|
||||
if (count >= stopAfter) {
|
||||
print("calling Agent.stop()");
|
||||
Agent.stop();
|
||||
}
|
||||
|
||||
print("count =" + count);
|
||||
count++;
|
||||
}
|
||||
|
||||
|
||||
// register the call back so it fires before each data send
|
||||
Agent.willSendVisualDataCallback.connect(endAfterAWhile);
|
||||
|
Loading…
Reference in a new issue