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
5abdabb7
Commit
5abdabb7
authored
7 years ago
by
joni
Browse files
Options
Downloads
Patches
Plain Diff
Update selectors in animated-robot-hands.js
parent
804e3e6b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/animated-robot-hands.js
+4
-11
4 additions, 11 deletions
src/components/animated-robot-hands.js
with
4 additions
and
11 deletions
src/components/animated-robot-hands.js
+
4
−
11
View file @
5abdabb7
...
...
@@ -14,30 +14,25 @@ const POSES = {
// it would be nice to animate the hands proportionally to those analog values.
AFRAME
.
registerComponent
(
"
animated-robot-hands
"
,
{
schema
:
{
leftHand
:
{
type
:
"
selector
"
,
default
:
"
#
left-hand
"
},
rightHand
:
{
type
:
"
selector
"
,
default
:
"
#
right-hand
"
}
leftHand
:
{
type
:
"
selector
"
,
default
:
"
#
player-left-controller
"
},
rightHand
:
{
type
:
"
selector
"
,
default
:
"
#
player-right-controller
"
}
},
init
:
function
()
{
this
.
playAnimation
=
this
.
playAnimation
.
bind
(
this
);
this
.
onModelLoaded
=
this
.
onModelLoaded
.
bind
(
this
);
this
.
el
.
addEventListener
(
"
model-loaded
"
,
this
.
onModelLoaded
);
},
onModelLoaded
:
function
()
{
// Get the three.js object in the scene graph that has the animation data
const
root
=
this
.
el
.
object3D
.
children
[
0
].
children
[
0
].
children
[
0
];
window
.
root
=
root
;
const
root
=
this
.
el
.
querySelector
(
"
a-gltf-entity .RootScene
"
).
object3D
.
children
[
0
];
this
.
mixer
=
new
THREE
.
AnimationMixer
(
root
);
// Set hands to open pose because the bind pose is funky due
// to the workaround for FBX2glTF animations.
this
.
openL
=
this
.
mixer
.
clipAction
(
POSES
.
open
+
"
_L
"
);
this
.
openR
=
this
.
mixer
.
clipAction
(
POSES
.
open
+
"
_R
"
);
this
.
openL
.
play
();
this
.
openR
.
play
();
this
.
loaded
=
true
;
},
play
:
function
()
{
...
...
@@ -51,7 +46,6 @@ AFRAME.registerComponent("animated-robot-hands", {
},
tick
:
function
(
t
,
dt
)
{
if
(
!
this
.
loaded
)
return
;
this
.
mixer
.
update
(
dt
/
1000
);
},
...
...
@@ -59,7 +53,6 @@ AFRAME.registerComponent("animated-robot-hands", {
// TODO: Transition from current pose (which may be BETWEEN two other poses)
// to the target pose, rather than stopping previous actions altogether.
playAnimation
:
function
(
evt
)
{
if
(
!
this
.
loaded
)
return
;
const
isLeft
=
evt
.
target
===
this
.
data
.
leftHand
;
// Stop the initial animations we started when the model loaded.
if
(
!
this
.
openLStopped
&&
isLeft
)
{
...
...
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