85 lines
No EOL
2.7 KiB
JavaScript
85 lines
No EOL
2.7 KiB
JavaScript
// moveOverlayTest
|
|
(function(){
|
|
|
|
var BINGO_CARD_HEIGHT = 800;
|
|
var BINGO_CARD_WIDTH = 600;
|
|
var Y_OFFSET_FOR_WINDOW = 24;
|
|
var viewport = Controller.getViewportDimensions();
|
|
var windowHeight = viewport.y;
|
|
var TWO_D_CARD_BLUE = "http://hifi-content.s3-us-west-1.amazonaws.com/rebecca/BongoBingo/assets/images/bingoblue.png";
|
|
var mousePress, mouseRelease, mouseMove;
|
|
|
|
|
|
|
|
var getInFrontOverlayProperties = function(positionInFront, dimensions, url) {
|
|
var index = MyAvatar.getJointIndex("Head");
|
|
|
|
return {
|
|
isSolid: true,
|
|
color: { blue: 0, green: 255, red: 30 },
|
|
position: MyAvatar.position, // Vec3.sum(Camera.position, Vec3.multiplyQbyV(Camera.orientation, positionInFront)),
|
|
rotation: Camera.orientation,
|
|
parentID: MyAvatar.sessionUUID,
|
|
parentJointIndex: index,
|
|
alpha: 1,
|
|
dimensions: {
|
|
x: 0.32781141996383667,
|
|
y: 0.5229358673095703,
|
|
z: 0.008075423538684845
|
|
},
|
|
drawInFront: true,
|
|
visible: true,
|
|
emissive: true,
|
|
glow: 1,
|
|
grabbable: true
|
|
};
|
|
};
|
|
|
|
var cardOverlay = Overlays.addOverlay("rectangle3d", getInFrontOverlayProperties());
|
|
// var testChild = Overlays.addOverlay("rectangle3d", {
|
|
// isSolid: true,
|
|
// color: { blue: 255, green: 0, red: 30 },
|
|
// position: MyAvatar.position, // Vec3.sum(Camera.position, Vec3.multiplyQbyV(Camera.orientation, positionInFront)),
|
|
// rotation: Camera.orientation,
|
|
// parentID: cardOverlay,
|
|
// alpha: 0.5,
|
|
// dimensions: {
|
|
// x: 0.12781141996383667,
|
|
// y: 0.3229358673095703,
|
|
// z: 0.008075423538684845
|
|
// },
|
|
// drawInFront: true,
|
|
// visible: true,
|
|
// emissive: true,
|
|
// glow: 1,
|
|
// grabbable: true
|
|
// });
|
|
|
|
var moving = false;
|
|
|
|
print(cardOverlay);
|
|
|
|
mouseRelease = Overlays.mouseReleaseOnOverlay.connect(function(overlayID, event) {
|
|
moving = false;
|
|
});
|
|
|
|
mousePress = Overlays.mousePressOnOverlay.connect(function(overlayID, event) {
|
|
if (overlayID === cardOverlay) {
|
|
print("Clicked my card");
|
|
moving = true;
|
|
}
|
|
});
|
|
|
|
mouseMove = Overlays.mouseMoveOnOverlay.connect(function(overlayID, event) {
|
|
if (moving) {
|
|
print("Moving");
|
|
Overlays.editOverlay(cardOverlay, {position: event.pos3D});
|
|
}
|
|
});
|
|
|
|
Script.scriptEnding.connect(function(){
|
|
Overlays.deleteOverlay(cardOverlay);
|
|
Overlays.deleteOverlay(testChild);
|
|
|
|
});
|
|
}()); |