Add files via upload

This commit is contained in:
Basinsky 2023-01-13 21:12:01 +01:00 committed by GitHub
parent 0785f077b4
commit a946ce3dde
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 559 additions and 0 deletions

Binary file not shown.

View file

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="50"
height="50"
viewBox="0 0 13.229166 13.229167"
version="1.1"
id="svg8"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
sodipodi:docname="CameraPos-active.svg">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="15.839192"
inkscape:cx="33.249877"
inkscape:cy="25.528549"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
units="px"
inkscape:pagecheckerboard="true"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Laag 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:#000000;fill-rule:evenodd;stroke-width:0.265739"
id="rect31"
width="6.6728063"
height="5.1449385"
x="1.8130012"
y="2.6392863" />
<path
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.250288px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 6.8654857,5.3609257 10.95805,2.9991358 10.97475,7.4835466 Z"
id="path856" />
<rect
style="fill:#000000;fill-opacity:1;stroke-width:0.352628"
id="rect858"
width="1.3836797"
height="3.8252952"
x="5.0641975"
y="7.6004772" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="50"
height="50"
viewBox="0 0 13.229166 13.229167"
version="1.1"
id="svg8"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
sodipodi:docname="CameraPos-inactive.svg">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="15.839192"
inkscape:cx="33.249877"
inkscape:cy="25.528549"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
units="px"
inkscape:pagecheckerboard="true"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Laag 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:#ffffff;fill-rule:evenodd;stroke-width:0.265739"
id="rect31"
width="6.6728063"
height="5.1449385"
x="1.8130012"
y="2.6392863" />
<path
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:0.250288px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 6.8654857,5.3609257 10.95805,2.9991358 10.97475,7.4835466 Z"
id="path856" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke-width:0.352628"
id="rect858"
width="1.3836797"
height="3.8252952"
x="5.0641975"
y="7.6004772" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -0,0 +1,86 @@
<html>
<head>
<title>Cameras</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Raleway:300,400,600,700" rel="stylesheet">
<style>
body {
width: 440px;
font-family: 'Raleway', sans-serif;
font-size: 16px;
display: flex;
align-items: center;
color: rgb(255, 255, 255);
background: linear-gradient(#2b2b2b, #285c81);
}
h1 {
width: 440px;
font-family: 'Raleway', sans-serif;
font-size: 20px;
display: flex;
align-items: center;
color: rgb(167, 223, 255);
}
h2 {
width: 440px;
font-family: 'Raleway', sans-serif;
font-size: 16px;
display: flex;
align-items: center;
color: rgb(255, 255, 255);
}
.top-bar {
height: 90px;
color: rgb(0, 153, 255);
font-size: 40px;
background: linear-gradient(#1d1c2e, #1e1e1e);
font-weight: bold;
display: flex;
align-items: center;
padding-left: 30px;
padding-right: 30px;
position: fixed;
width: 480px;
top: 0;
z-index: 1;
}
.content {
margin-top: 100px;
padding: 2px 2px;
font-weight: normal;
position: fixed;
top: 0;
z-index: 1;
}
</style>
</head>
<body >
<div class="top-bar">
<h4>Camera position app</h4>
</div>
<div class="content">
<p> This app is used to setup camera positions for streaming or recording. With it you can capture the position of the overte camera </p>
<p> Keyboard shortcuts: <br />
<h1>F1 to F12:</h1>
<h2>go into camera mode, fullscreen, no overlays</h2>
<h1>Shift + F1 to F12:</h1>
<h2>add camera at current viewpoint</h2>
<h2>using Shift + F1 to F12 on existing camera removes it</h2>
<h1>c:</h1>
<h2>change audio mode: avatar - camera</h2>
<h1>n:</h1>
<h2>get out of camera mode</h2>
<h1>l:</h1>
<h2>toggles visibity of the camera entities</h2>
<h1>m:</h1>
<h2>gather cameras on the domain when you loose them</h2>
<h1>4,6:</h1>
<h2>in camera mode, rotate around y-axis</h2>
<h1>8,5:</h1>
<h2>in camera mode, rotate around x-axis</h2>
</body>
</html>

View file

@ -0,0 +1,323 @@
//
// CameraPositions.js
//
// Created by Basinsky on 5 Mar 2021
//
// script to setup camera's for an event
// press shift + F1 to F12 on the keyboard to create a camera at the position of the current Overte Camera
// press F1 to F12 to switch between camera points if they exist
// press c to change audi mode (Avatar-Camera)
// press n to quit camera mode
// press l to hide/unhide the camera's
// press m to update the camera list if you crashed or left the domain and come back
// stopping the script will remove the camera's
// using numbers on the keypad (4,6) for the y axis and (8,5) for the x axis you can rotate the camera to adjust it
// for events make sure to put the view on fullscreen from the pulldown menu and disable your audio level meter.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
(function() {
var LOCATION_ROOT_URL = Script.resolvePath(".");
var FORM_URL = "https://htmlpreview.github.io/?" + LOCATION_ROOT_URL + "CameraPos.html?" + Date.now();
var onForm = false;
var button;
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var allEntities;
var TOTAL_CAMERAS = 12;
var cameraIDs = [];
var reset = true;
var RESET_TIME = 20;
var cameraCounter = 0;
var isVisible = true;
var isFullscreen = false;
var isOverlays = true;
var isRunning = false;
var isCameraListeningPosition = false;
var HALF_CIRCLE_DEGREE = 180;
// Fill array
for (var i = 0; i < TOTAL_CAMERAS+1; i++) {
cameraIDs[i] = "X";
}
button = tablet.addButton({
icon: LOCATION_ROOT_URL + "CameraPos-inactive.svg",
activeIcon: LOCATION_ROOT_URL + "CameraPos-active.svg",
text: "CAMERAS"
});
function onClicked() {
if (onForm) {
tablet.gotoHomeScreen();
} else {
onForm = true;
tablet.gotoWebScreen(FORM_URL);
}
}
function onScreenChanged(type, url) {
print(JSON.stringify(url));
if (type === "Web" && url.indexOf(FORM_URL) !== -1) {
button.editProperties({ isActive: true });
} else {
button.editProperties({ isActive: false });
onForm = false;
}
}
function generateQuatFromDegreesViaRadians(rotxdeg,rotydeg,rotzdeg) {
var rotxrad = (rotxdeg/HALF_CIRCLE_DEGREE)*Math.PI;
var rotyrad = (rotydeg/HALF_CIRCLE_DEGREE)*Math.PI;
var rotzrad = (rotzdeg/HALF_CIRCLE_DEGREE)*Math.PI;
var newRotation = Quat.fromPitchYawRollRadians(rotxrad,rotyrad,rotzrad);
return newRotation;
}
function getCameras() {
for (var i = 0; i < TOTAL_CAMERAS; i++) {
cameraIDs[i] = "X";
}
allEntities = Entities.findEntities(MyAvatar.position, 10000);
for (var j in allEntities) {
var props = Entities.getEntityProperties(allEntities[j]);
if (props.name.slice(0,6) === "Camera") {
print(props.name);
var cameraNumber = parseInt(props.name.slice(6));
cameraIDs[cameraNumber] = props.id;
}
}
}
function addCamera(counter) {
var currentCameraRotation = Camera.orientation;
var currentCameraPosition = Camera.position;
var cameraID = Entities.addEntity({
type: "Model",
name: "Camera" + counter,
position: currentCameraPosition,
rotation: currentCameraRotation,
collisionless: true,
visible: true,
modelURL: LOCATION_ROOT_URL + "Camera.fbx?" + Date.now(),
userData: "{ \"grabbableKey\": { \"grabbable\": true, \"triggerable\": false}}"
});
Entities.addEntity({
type: "Text",
name: "TextCamera" + counter,
parentID: cameraID,
collisionless: true,
localPosition: {x: 0,y: 0.16 ,z: 0.32},
localRotation: generateQuatFromDegreesViaRadians(0,0,0),
text: "F" + counter,
lineHeight: 0.18,
localDimensions: {x: 0.2763 ,y: 0.1817 ,z: 0.01}
});
cameraIDs[counter] = cameraID;
}
function removeCamera(counter) {
Entities.deleteEntity(cameraIDs[counter]);
cameraIDs[counter] = "X";
}
function showCameraView(counter) {
isRunning = true;
var isFullscreen = Menu.isOptionChecked("Fullscreen");
if (!isFullscreen) {
Menu.triggerOption('Fullscreen');
}
var isOverlays = Menu.isOptionChecked("Show Overlays");
if (isOverlays) {
Menu.triggerOption('Show Overlays');
}
Camera.captureMouse = true;
Camera.mode = "entity";
Camera.cameraEntity = cameraIDs[counter];
// set listener position to camera position
Script.setTimeout(function () {
MyAvatar.audioListenerMode = MyAvatar.audioListenerModeCustom;
MyAvatar.customListenPosition = Camera.position;
MyAvatar.customListenOrientation = Camera.orientation;
isCameraListeningPosition = true;
}, 100);
if (isVisible) {
showMessage("F" + counter, 150 , 200);
}
}
function rotateCamera(xAxis,yAxis) {
var cameraProps = Entities.getEntityProperties(cameraIDs[cameraCounter]);
print(cameraProps.name);
var eulerAngles = Quat.safeEulerAngles(cameraProps.rotation);
eulerAngles.y = eulerAngles.y + yAxis * 0.2;
eulerAngles.x = eulerAngles.x + xAxis * 0.2;
print(JSON.stringify({x: eulerAngles.x,y: eulerAngles.y,z: eulerAngles.z}));
var newRotation = Quat.fromPitchYawRollDegrees(eulerAngles.x, eulerAngles.y, eulerAngles.z );
Entities.editEntity(cameraIDs[cameraCounter],{rotation: newRotation});
}
function toggleVisibility() {
isVisible = !isVisible;
for (var i in cameraIDs) {
if (cameraIDs[i] !== "X") {
Entities.editEntity(cameraIDs[i], {visible: isVisible });
var childEntities = Entities.getChildrenIDs(cameraIDs[i]);
for (var j in childEntities) {
Entities.editEntity(childEntities[j], {visible: isVisible });
}
}
}
}
function toggleListeningMethod() {
isCameraListeningPosition = !isCameraListeningPosition;
var modeMessage;
if (isCameraListeningPosition) {
modeMessage = "audio mode:\n\n Camera";
Script.setTimeout(function () {
MyAvatar.audioListenerMode = MyAvatar.audioListenerModeCustom;
MyAvatar.customListenPosition = Camera.position;
MyAvatar.customListenOrientation = Camera.orientation;
isCameraListeningPosition = true;
}, 100);
} else {
modeMessage = "audio mode:\n\n Avatar";
Script.setTimeout(function () {
MyAvatar.audioListenerMode = MyAvatar.audioListenerModeHead;
isCameraListeningPosition = false;
}, 100);
}
showMessage(modeMessage, 30 ,200);
}
function showMessage(messageText, fontHeight, size) {
var xposition = Window.innerWidth/2;
var yposition = Window.innerHeight/2;
var overlayID = Overlays.addOverlay("text", {
x: xposition - size/2,
y: yposition - size/2,
width: size,
height: size,
leftMargin: 20,
topMargin: 20,
text: messageText,
font: {size: fontHeight},
backgroundColor: {r: 100,g: 100,b: 100}
});
Script.setTimeout(function () {
Overlays.deleteOverlay(overlayID);
}, 1000);
}
Script.setInterval(function () {
reset = true;
}, RESET_TIME);
function keyPressEvent(event) {
if (reset) {
if (event.text.toLowerCase() === "k" ) {
isFullscreen = Menu.isOptionChecked("Fullscreen");
if (!isFullscreen) {
Menu.triggerOption('Fullscreen');
}
isOverlays = Menu.isOptionChecked("Show Overlays");
if (!isOverlays) {
Menu.triggerOption('Show Overlays');
}
}
if (event.text.toLowerCase() === "m" ) {
print("m pressed");
getCameras();
}
if (event.text.toLowerCase() === "n" ) {
isFullscreen = Menu.isOptionChecked("Fullscreen");
if (isFullscreen) {
Menu.triggerOption('Fullscreen');
}
isOverlays = Menu.isOptionChecked("Show Overlays");
if (!isOverlays) {
Menu.triggerOption('Show Overlays');
}
Camera.mode = "first person";
Camera.captureMouse = false;
MyAvatar.audioListenerMode = MyAvatar.audioListenerModeHead;
isCameraListeningPosition = false;
isRunning = false;
}
if (event.text.toLowerCase() === "l" ) {
toggleVisibility();
}
if (event.text === "4" ) {
// left
rotateCamera(0,-1);
}
if (event.text === "5" ) {
// down
rotateCamera(-1,0);
}
if (event.text === "6" ) {
// right
rotateCamera(0,1);
}
if (event.text === "8" ) {
// up
rotateCamera(1,0);
}
if (event.text.toLowerCase() === "c" ) {
if (isRunning) {
toggleListeningMethod();
}
}
if (event.text.slice(0,1) === "F" && event.text.length > 1 && event.isShifted) {
cameraCounter = (parseInt(event.text.slice(1)));
print("de cameracounter = " + (parseInt(event.text.slice(1))));
if (cameraIDs[cameraCounter] === "X") {
print("adding camera " + cameraCounter);
addCamera(cameraCounter);
} else {
removeCamera(cameraCounter);
print("removing camera " + cameraCounter);
}
print(JSON.stringify(cameraIDs));
}
if (event.text.slice(0,1) === "F" && event.text.length > 1 && !event.isShifted) {
cameraCounter = parseInt(event.text.slice(1));
if (cameraIDs[cameraCounter] !== "X") {
print("showing camera " + cameraCounter);
showCameraView(cameraCounter);
}
}
reset = false;
}
}
Script.scriptEnding.connect(function () {
if (onForm) {
tablet.gotoHomeScreen();
}
button.clicked.disconnect(onClicked);
tablet.screenChanged.disconnect(onScreenChanged);
if (tablet) {
tablet.removeButton(button);
}
Controller.keyPressEvent.disconnect(keyPressEvent);
for (var j in cameraIDs) {
// Entities.deleteEntity(cameraIDs[j]);
}
Camera.mode = "first person";
Camera.captureMouse = false;
MyAvatar.audioListenerMode = MyAvatar.audioListenerModeHead;
isCameraListeningPosition = false;
});
button.clicked.connect(onClicked);
tablet.screenChanged.connect(onScreenChanged);
Controller.keyPressEvent.connect(keyPressEvent);
}());