mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 18:42:58 +02:00
changed second hand to hour hand
This commit is contained in:
parent
4eb37dac25
commit
72c0f84d2e
1 changed files with 27 additions and 25 deletions
|
@ -16,9 +16,9 @@ var CLOCK_HOUR_HAND_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/
|
||||||
var CLOCK_MINUTE_HAND_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/cuckooClock2_MINUTE_HAND.fbx";
|
var CLOCK_MINUTE_HAND_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/cuckooClock2_MINUTE_HAND.fbx";
|
||||||
|
|
||||||
MyCuckooClock = function(spawnPosition, spawnRotation) {
|
MyCuckooClock = function(spawnPosition, spawnRotation) {
|
||||||
var clockBody, clockFace, clockHourHand;
|
var clockBody, clockFace, clockMinuteHand, clockHourHand, clockSecondHand;
|
||||||
|
|
||||||
function createClockBody() {
|
function createClock() {
|
||||||
|
|
||||||
clockBody = Entities.addEntity({
|
clockBody = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
|
@ -61,17 +61,19 @@ MyCuckooClock = function(spawnPosition, spawnRotation) {
|
||||||
var clockHandOffset = {x: -0.0007, y: -0.0015, z: 0.0121};
|
var clockHandOffset = {x: -0.0007, y: -0.0015, z: 0.0121};
|
||||||
|
|
||||||
var myDate = new Date()
|
var myDate = new Date()
|
||||||
var DEGREES_PER_SECOND = 6;
|
|
||||||
var DEGREES_PER_MINUTE = 6;
|
|
||||||
var ANGULAR_ROLL_SPEED_MINUTE_RADIANS = 0.00174533;
|
// MINUTE HAND ************************
|
||||||
var minutes = myDate.getMinutes();
|
var minutes = myDate.getMinutes();
|
||||||
var rollDegrees = -minutes * DEGREES_PER_MINUTE;
|
var minuteRollDegrees = -minutes * DEGREES_FOR_MINUTE;
|
||||||
clockHourHand = Entities.addEntity({
|
var ANGULAR_ROLL_SPEED_MINUTE_RADIANS = 0.00174533;
|
||||||
|
var DEGREES_FOR_MINUTE = 6;
|
||||||
|
clockMinuteHand = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
modelURL: CLOCK_HOUR_HAND_URL,
|
modelURL: CLOCK_HOUR_HAND_URL,
|
||||||
position: Vec3.sum(clockFacePosition, clockHandOffset),
|
position: Vec3.sum(clockFacePosition, clockHandOffset),
|
||||||
registrationPoint: {x: 0.5, y: 0.05, z: 0.5},
|
registrationPoint: {x: 0.5, y: 0.05, z: 0.5},
|
||||||
rotation: Quat.fromPitchYawRollDegrees(0, 0, rollDegrees),
|
rotation: Quat.fromPitchYawRollDegrees(0, 0, minuteRollDegrees),
|
||||||
angularDamping: 0,
|
angularDamping: 0,
|
||||||
angularVelocity: {x: 0, y: 0, z: -ANGULAR_ROLL_SPEED_MINUTE_RADIANS},
|
angularVelocity: {x: 0, y: 0, z: -ANGULAR_ROLL_SPEED_MINUTE_RADIANS},
|
||||||
dimensions: {
|
dimensions: {
|
||||||
|
@ -81,41 +83,41 @@ MyCuckooClock = function(spawnPosition, spawnRotation) {
|
||||||
},
|
},
|
||||||
// script: SCRIPT_URL
|
// script: SCRIPT_URL
|
||||||
});
|
});
|
||||||
|
// *******************************************
|
||||||
|
|
||||||
|
var DEGREES_FOR_SECOND = 6;
|
||||||
var seconds = myDate.getSeconds();
|
var seconds = myDate.getSeconds();
|
||||||
|
secondRollDegrees = -seconds * DEGREES_FOR_SECOND;
|
||||||
print("EBL SECONDS " + seconds)
|
var ANGULAR_ROLL_SPEED_SECOND_RADIANS = 0.10472
|
||||||
rollDegrees = -seconds * DEGREES_PER_SECOND;
|
clockSecondHand = Entities.addEntity({
|
||||||
var ANGULAR_ROLL_SPEED_SECOND_RADIANS = 0.10472
|
type: "Box",
|
||||||
clockMinuteHand = Entities.addEntity({
|
// modelURL: CLOCK_MINUTE_HAND_URL,
|
||||||
type: "Model",
|
|
||||||
modelURL: CLOCK_MINUTE_HAND_URL,
|
|
||||||
position: Vec3.sum(clockFacePosition, clockHandOffset),
|
position: Vec3.sum(clockFacePosition, clockHandOffset),
|
||||||
dimensions: {
|
dimensions: {
|
||||||
x: 0.0263,
|
x: 0.00263,
|
||||||
y: 0.0982,
|
y: 0.0982,
|
||||||
z: 0.0024
|
z: 0.0024
|
||||||
},
|
},
|
||||||
|
color: {red: 200, green: 10, blue: 200},
|
||||||
registrationPoint: {x: 0.5, y: 0.05, z: 0.5},
|
registrationPoint: {x: 0.5, y: 0.05, z: 0.5},
|
||||||
rotation: Quat.fromPitchYawRollDegrees(0, 0, rollDegrees),
|
rotation: Quat.fromPitchYawRollDegrees(0, 0, secondRollDegrees),
|
||||||
angularDamping: 0,
|
angularDamping: 0,
|
||||||
angularVelocity: {x: 0, y: 0, z: -ANGULAR_ROLL_SPEED_SECOND_RADIANS}
|
angularVelocity: {x: 0, y: 0, z: -ANGULAR_ROLL_SPEED_SECOND_RADIANS}
|
||||||
// script: SCRIPT_URL
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print("EBL IM A CUCKOO CLOCK");
|
print("EBL IM A CUCKOO CLOCK");
|
||||||
|
|
||||||
createClockBody();
|
createClock();
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
print('cuckoo cleanup')
|
print('cuckoo cleanup')
|
||||||
// Entities.deleteEntity(clockBody);
|
Entities.deleteEntity(clockBody);
|
||||||
// Entities.deleteEntity(clockFace);
|
Entities.deleteEntity(clockFace);
|
||||||
// Entities.deleteEntity(clockHourHand);
|
Entities.deleteEntity(clockHourHand);
|
||||||
// Entities.deleteEntity(clockMinuteHand);
|
Entities.deleteEntity(clockMinuteHand);
|
||||||
|
Entities.deleteEntity(clockSecondHand);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue