Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
Hubs
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ar-noc
Hubs
Commits
ec715434
Commit
ec715434
authored
7 years ago
by
Kevin Lee
Browse files
Options
Downloads
Patches
Plain Diff
format with eslint
parent
aad9ae8c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/spawn-controller.js
+21
-17
21 additions, 17 deletions
src/components/spawn-controller.js
with
21 additions
and
17 deletions
src/components/spawn-controller.js
+
21
−
17
View file @
ec715434
AFRAME
.
registerComponent
(
'
spawn-controller
'
,
{
AFRAME
.
registerComponent
(
"
spawn-controller
"
,
{
schema
:
{
radius
:
{
type
:
'
number
'
,
default
:
1
}
,
radius
:
{
type
:
"
number
"
,
default
:
1
}
},
init
:
function
()
{
var
el
=
this
.
el
;
var
center
=
el
.
getAttribute
(
'
position
'
);
init
()
{
const
el
=
this
.
el
;
const
center
=
el
.
getAttribute
(
"
position
"
);
var
angleRad
=
Math
.
random
()
*
2
*
Math
.
PI
;
var
circlePoint
=
this
.
getPointOnCircle
(
this
.
data
.
radius
,
angleRad
);
var
worldPoint
=
{
x
:
circlePoint
.
x
+
center
.
x
,
y
:
center
.
y
,
z
:
circlePoint
.
z
+
center
.
z
};
el
.
setAttribute
(
'
position
'
,
worldPoint
);
const
angleRad
=
Math
.
random
()
*
2
*
Math
.
PI
;
const
circlePoint
=
this
.
getPointOnCircle
(
this
.
data
.
radius
,
angleRad
);
const
worldPoint
=
{
x
:
circlePoint
.
x
+
center
.
x
,
y
:
center
.
y
,
z
:
circlePoint
.
z
+
center
.
z
};
el
.
setAttribute
(
"
position
"
,
worldPoint
);
var
angleDeg
=
angleRad
*
THREE
.
Math
.
RAD2DEG
;
var
angleToCenter
=
-
1
*
angleDeg
+
90
;
el
.
setAttribute
(
'
rotation
'
,
{
x
:
0
,
y
:
angleToCenter
,
z
:
0
});
const
angleDeg
=
angleRad
*
THREE
.
Math
.
RAD2DEG
;
const
angleToCenter
=
-
1
*
angleDeg
+
90
;
el
.
setAttribute
(
"
rotation
"
,
{
x
:
0
,
y
:
angleToCenter
,
z
:
0
});
},
getPointOnCircle
:
function
(
radius
,
angleRad
)
{
var
x
=
Math
.
cos
(
angleRad
)
*
radius
;
var
z
=
Math
.
sin
(
angleRad
)
*
radius
;
return
{
x
:
x
,
z
:
z
};
getPointOnCircle
(
radius
,
angleRad
)
{
const
x
=
Math
.
cos
(
angleRad
)
*
radius
;
const
z
=
Math
.
sin
(
angleRad
)
*
radius
;
return
{
x
:
x
,
z
:
z
};
}
});
\ No newline at end of file
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment