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
04be39d5
Commit
04be39d5
authored
7 years ago
by
Robert Long
Browse files
Options
Downloads
Patches
Plain Diff
Added personal-space-bubble-component.
parent
e06bcc73
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
public/index.html
+2
-1
2 additions, 1 deletion
public/index.html
src/index.js
+2
-0
2 additions, 0 deletions
src/index.js
src/systems/personal-space-bubble.js
+73
-0
73 additions, 0 deletions
src/systems/personal-space-bubble.js
with
77 additions
and
1 deletion
public/index.html
+
2
−
1
View file @
04be39d5
...
...
@@ -35,11 +35,12 @@
matcolor
-
audio
-
feedback
=
"
objectName: DodecAvatar_Head_0
"
scale
-
audio
-
feedback
avatar
-
customization
personal
-
space
-
bubble
><
/a-entity
>
</script>
<script
id=
"hand-template"
type=
"text/html"
>
<
a
-
box
class
=
"
hand
"
scale
=
"
0.2 0.1 0.3
"
><
/a-box
>
<
a
-
box
class
=
"
hand
"
personal
-
space
-
bubble
scale
=
"
0.2 0.1 0.3
"
><
/a-box
>
</script>
<script
id=
"nametag-template"
type=
"text/html"
>
...
...
This diff is collapsed.
Click to expand it.
src/index.js
+
2
−
0
View file @
04be39d5
...
...
@@ -11,6 +11,8 @@ import "./components/nametag-transform";
import
"
./components/avatar-customization
"
;
import
"
./components/mute-state-indicator
"
;
import
"
./systems/personal-space-bubble
"
;
import
{
generateName
}
from
"
./utils
"
;
NAF
.
schemas
.
add
({
...
...
This diff is collapsed.
Click to expand it.
src/systems/personal-space-bubble.js
0 → 100644
+
73
−
0
View file @
04be39d5
var
posA
=
new
AFRAME
.
THREE
.
Vector3
();
var
posB
=
new
AFRAME
.
THREE
.
Vector3
();
function
distance
(
entityA
,
entityB
)
{
entityA
.
object3D
.
getWorldPosition
(
posA
);
entityB
.
object3D
.
getWorldPosition
(
posB
);
return
posA
.
distanceTo
(
posB
);
}
AFRAME
.
registerSystem
(
"
personal-space-bubble
"
,
{
init
()
{
this
.
myEntities
=
[];
this
.
entities
=
[];
},
registerEntity
(
el
)
{
var
networkedEl
=
NAF
.
utils
.
getNetworkedEntity
(
el
);
var
owner
=
NAF
.
utils
.
getNetworkOwner
(
networkedEl
);
if
(
owner
!==
NAF
.
clientId
)
{
this
.
entities
.
push
(
el
);
}
else
{
this
.
myEntities
.
push
(
el
);
}
},
unregisterEntity
(
el
)
{
var
networkedEl
=
NAF
.
utils
.
getNetworkedEntity
(
el
);
var
owner
=
NAF
.
utils
.
getNetworkOwner
(
networkedEl
);
if
(
owner
!==
NAF
.
clientId
)
{
var
index
=
this
.
entities
.
indexOf
(
el
);
this
.
entities
.
splice
(
index
,
1
);
}
else
{
var
index
=
this
.
myEntities
.
indexOf
(
el
);
this
.
myEntities
.
splice
(
index
,
1
);
}
},
tick
()
{
for
(
var
j
=
0
;
j
<
this
.
entities
.
length
;
j
++
)
{
var
otherEntity
=
this
.
entities
[
j
];
var
visible
=
true
;
for
(
var
i
=
0
;
i
<
this
.
myEntities
.
length
;
i
++
)
{
var
myEntity
=
this
.
myEntities
[
i
];
var
d
=
distance
(
myEntity
,
otherEntity
);
if
(
d
<
myEntity
.
components
[
"
personal-space-bubble
"
].
data
.
radius
)
{
visible
=
false
;
break
;
}
}
otherEntity
.
object3D
.
visible
=
visible
;
}
}
});
AFRAME
.
registerComponent
(
"
personal-space-bubble
"
,
{
schema
:
{
radius
:
{
type
:
"
number
"
,
default
:
0.8
}
},
init
()
{
this
.
system
.
registerEntity
(
this
.
el
);
},
remove
()
{
this
.
system
.
unregisterEntity
(
this
.
el
);
}
});
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