mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 20:16:16 +02:00
Moved velocity and angularVelocity into the SpatiallyNestable base class. Entity velocity and angularVelocity properties are now relative to their parent, similar to the way position and orientation work for entities. MyAvatar rig animations now use SpatiallyNestable to convert velocity into local frame to drive the animation state machine.
40 lines
892 B
JavaScript
40 lines
892 B
JavaScript
var platform;
|
|
|
|
function init() {
|
|
platform = Entities.addEntity({
|
|
name: "platform",
|
|
type: "Box",
|
|
position: { x: 0, y: 0, z: 0 },
|
|
dimensions: { x: 10, y: 2, z: 10 },
|
|
color: { red: 0, green: 0, blue: 255 },
|
|
gravity: { x: 0, y: 0, z: 0 },
|
|
visible: true,
|
|
locked: false,
|
|
lifetime: 6000,
|
|
velocity: { x: 1.0, y: 0, z: 0 },
|
|
damping: 0,
|
|
isDynamic: false
|
|
});
|
|
if (platform) {
|
|
if (MyAvatar.getParentID() != platform) {
|
|
MyAvatar.position = { x: 0, y: 3, z: 0 };
|
|
MyAvatar.setParentID(platform);
|
|
}
|
|
}
|
|
}
|
|
|
|
function update(dt) {
|
|
|
|
}
|
|
|
|
function shutdown() {
|
|
if (platform) {
|
|
MyAvatar.setParentID(0);
|
|
Entities.deleteEntity(platform);
|
|
}
|
|
}
|
|
|
|
Script.setTimeout(init, 3000);
|
|
|
|
Script.update.connect(update);
|
|
Script.scriptEnding.connect(shutdown);
|