mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 23:49:55 +02:00
rotating blade
This commit is contained in:
parent
0846c3bef4
commit
ed2bd07585
1 changed files with 35 additions and 15 deletions
|
@ -1,5 +1,10 @@
|
||||||
var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/helicopter.fbx?v3";
|
var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/helicopter.fbx?v3";
|
||||||
var spawnPosition = {x: 1031, y: 135, z: 1041};
|
var animationURL = "https://s3.amazonaws.com/hifi-public/eric/models/bladeAnimation.fbx?v7";
|
||||||
|
var spawnPosition = {
|
||||||
|
x: 1031,
|
||||||
|
y: 135,
|
||||||
|
z: 1041
|
||||||
|
};
|
||||||
|
|
||||||
var speed = .1;
|
var speed = .1;
|
||||||
|
|
||||||
|
@ -15,7 +20,7 @@ var MODEL_LIGHT_POSITION = {
|
||||||
y: 0,
|
y: 0,
|
||||||
z: -5
|
z: -5
|
||||||
};
|
};
|
||||||
var MODEL_LIGHT_ROTATION = Quat.angleAxis(0, {
|
var MODEL_LIGHT_ROTATION = Quat.angleAxis(0, {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 0,
|
||||||
z: 1
|
z: 1
|
||||||
|
@ -35,7 +40,17 @@ var helicopter = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
name: "Helicopter",
|
name: "Helicopter",
|
||||||
modelURL: modelURL,
|
modelURL: modelURL,
|
||||||
dimensions: {x: 12.13, y: 3.14, z: 9.92},
|
animation: {
|
||||||
|
url: animationURL,
|
||||||
|
running: true,
|
||||||
|
fps: 180
|
||||||
|
|
||||||
|
},
|
||||||
|
dimensions: {
|
||||||
|
x: 12.13,
|
||||||
|
y: 3.14,
|
||||||
|
z: 9.92
|
||||||
|
},
|
||||||
// rotation: Quat.fromPitchYawRollDegrees(0, -90, 0),
|
// rotation: Quat.fromPitchYawRollDegrees(0, -90, 0),
|
||||||
position: spawnPosition,
|
position: spawnPosition,
|
||||||
});
|
});
|
||||||
|
@ -87,25 +102,30 @@ function update() {
|
||||||
var modelProperties = Entities.getEntityProperties(helicopter, ['position', 'rotation']);
|
var modelProperties = Entities.getEntityProperties(helicopter, ['position', 'rotation']);
|
||||||
var lightTransform = evalLightWorldTransform(modelProperties.position, modelProperties.rotation);
|
var lightTransform = evalLightWorldTransform(modelProperties.position, modelProperties.rotation);
|
||||||
Entities.editEntity(spotlight, {
|
Entities.editEntity(spotlight, {
|
||||||
position: lightTransform.p,
|
position: lightTransform.p,
|
||||||
// rotation: lightTransform.q
|
// rotation: lightTransform.q
|
||||||
});
|
});
|
||||||
Entities.editEntity(debugLight, {
|
Entities.editEntity(debugLight, {
|
||||||
position: lightTransform.p,
|
position: lightTransform.p,
|
||||||
rotation: lightTransform.q
|
rotation: lightTransform.q
|
||||||
});
|
});
|
||||||
|
|
||||||
audioInjector.setOptions({
|
audioInjector.setOptions({
|
||||||
position: modelProperties.position,
|
position: modelProperties.position,
|
||||||
});
|
});
|
||||||
|
|
||||||
//Move forward
|
//Move forward
|
||||||
var newRotation = Quat.multiply(modelProperties.rotation, {x: 0, y: .001, z: 0, w: 1})
|
var newRotation = Quat.multiply(modelProperties.rotation, {
|
||||||
var newPosition = Vec3.sum(modelProperties.position, Vec3.multiply(speed, Quat.getFront(modelProperties.rotation)));
|
x: 0,
|
||||||
Entities.editEntity(helicopter, {
|
y: .001,
|
||||||
|
z: 0,
|
||||||
|
w: 1
|
||||||
|
})
|
||||||
|
var newPosition = Vec3.sum(modelProperties.position, Vec3.multiply(speed, Quat.getFront(modelProperties.rotation)));
|
||||||
|
Entities.editEntity(helicopter, {
|
||||||
position: newPosition,
|
position: newPosition,
|
||||||
rotation: newRotation
|
rotation: newRotation
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue