Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lzi-metaverse-test
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dietrich Karl-Heinz Gerstenberger
lzi-metaverse-test
Merge requests
!1
An error occurred while fetching the assigned milestone of the selected merge_request.
Create dancing_light_box.js
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Create dancing_light_box.js
davidb95/lzi-metaverse-test:davidb95-main-patch-49063
into
main
Overview
0
Commits
1
Pipelines
0
Changes
1
Merged
Create dancing_light_box.js
David Berendes
requested to merge
davidb95/lzi-metaverse-test:davidb95-main-patch-49063
into
main
May 8, 2023
Overview
0
Commits
1
Pipelines
0
Changes
1
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
2acdc380
1 commit,
May 8, 2023
1 file
+
44
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
scripts/dancing_light_box.js
0 → 100644
+
44
−
0
View file @ 2acdc380
Edit in single-file editor
Open in Web IDE
(
function
(){
var
lightID
=
"
{d4e37d71-b6e4-425d-ab2b-673f09fb1339}
"
var
minX
=
-
110
;
var
maxX
=
-
70
;
var
yDeg
=
0
;
var
minZ
=
-
20
;
var
maxZ
=
20
;
// Aktualisiert die Rotation der Lichtquelle
function
setRotation
()
{
//Zufälliger Winkel
const
rangeX
=
maxX
-
minX
;
const
randomNumberInRangeX
=
Math
.
random
()
*
rangeX
;
const
randomNumberBetweenX
=
randomNumberInRangeX
+
minX
;
const
rangeZ
=
maxZ
-
minZ
;
const
randomNumberInRangeZ
=
Math
.
random
()
*
rangeZ
;
const
randomNumberBetweenZ
=
randomNumberInRangeZ
+
minZ
;
// Konvertieren Grad in Radiant
const
xRad
=
(
randomNumberBetweenX
/
180
)
*
Math
.
PI
;
const
yRad
=
(
yDeg
/
180
)
*
Math
.
PI
;
const
zRad
=
(
randomNumberBetweenZ
/
180
)
*
Math
.
PI
;
// Die Entity mit der gegebenen ID finden
const
entity
=
Entities
.
getEntityProperties
(
lightID
);
// Die aktuelle Rotation der Entity abrufen
const
currentRotation
=
entity
.
rotation
;
// Die neue Rotation berechnen
const
newRotation
=
Quat
.
fromPitchYawRollRadians
(
xRad
,
yRad
,
zRad
);
// Die neue Rotation auf die Entity setzen
Entities
.
editEntity
(
lightID
,
{
rotation
:
newRotation
});
}
this
.
enterEntity
=
function
(
entityID
)
{
Script
.
setInterval
(
setRotation
,
500
);
};
});
\ No newline at end of file
Loading