# Simple Animation Blend

**URL:** <https://forum.playcanvas.com/t/simple-animation-blend/6784>\
**Category:** Help & Support\
**Created:** [April 30, 2018, 3:43pm UTC](https://forum.playcanvas.com/t/simple-animation-blend/6784 "2018-04-30T15:43:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![SkitzFritz](https://forum.playcanvas.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@SkitzFritz](https://forum.playcanvas.com/u/SkitzFritz)\
**Post date:** [April 30, 2018, 3:43pm UTC](https://forum.playcanvas.com/t/simple-animation-blend/6784/1 "2018-04-30T15:43:29Z")

</div>

Hi,

I’ve created two animated elements, a dummy object that follows a path and a character with a simple walk cycle. I was hoping to be able to parent one to the other but this approach doesn’t seem to work. I’ve made a simple scene to illustrate what i’m trying to do, the box isn’t animated in this instance but it still doesn’t follow its parent.

Any ideas? Maybe i’m just coming at this from the wrong angle.

[https://playcanvas.com/editor/scene/607533](https://playcanvas.com/editor/scene/607533)

Thanks,

SF

---

<div class="post-metadata">

**Author:** ![yaustar](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/yaustar/32/2268_2.png) [@yaustar](https://forum.playcanvas.com/u/yaustar)\
**Post date:** [April 30, 2018, 10:11pm UTC](https://forum.playcanvas.com/t/simple-animation-blend/6784/2 "2018-04-30T22:11:24Z")

</div>

Am I correct in saying that you want the large box to be in the same position as the arrow mesh?

If so, making it a child won’t work as the entity that has the animated model doesn’t move, it’s the mesh that is moving.

What you can do is get the graphNode of the animated mesh in the entity ‘SK\_Path’. If you look at the children of the entity ‘SK\_Path’, you should seethe Box entity and graph nodes of the model.

On the post update, you can set the position of the Box entity to be the same as the animated graphNode.

---

<div class="post-metadata">

**Author:** ![SkitzFritz](https://forum.playcanvas.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@SkitzFritz](https://forum.playcanvas.com/u/SkitzFritz)\
**Post date:** [May 1, 2018, 8:47am UTC](https://forum.playcanvas.com/t/simple-animation-blend/6784/3 "2018-05-01T08:47:00Z")

</div>

Hi Yaustar,

Thanks for the quick reply, I’m still having trouble finding the node within SK\_Path that actually moves, I’ve tried a few things the latest of which is this, i’m just logging the result so i can see the change;

could i have another nudge in the right direction please.

```javascript
// initialize code called once per entity
FollowMesh.prototype.initialize = function() {
    
    var childEntity = this.entity;
    var parentEntity = childEntity.parent;
    this.model = parentEntity.model;
    console.log(this.model);
    
};

// update code called every frame
FollowMesh.prototype.update = function(dt) {
    console.log(this.model.entity.position);
};

```

---

<div class="post-metadata">

**Author:** ![yaustar](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/yaustar/32/2268_2.png) [@yaustar](https://forum.playcanvas.com/u/yaustar)\
**Post date:** [May 1, 2018, 10:23am UTC](https://forum.playcanvas.com/t/simple-animation-blend/6784/4 "2018-05-01T10:23:32Z")

</div>

In the console, print out all the names of the children graphNodes of ‘SK\_Path’. You should see one being ‘Box’ and another the name of the mesh instance that is being animated.

---

<div class="post-metadata">

**Author:** ![SkitzFritz](https://forum.playcanvas.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@SkitzFritz](https://forum.playcanvas.com/u/SkitzFritz)\
**Post date:** [May 1, 2018, 4:00pm UTC](https://forum.playcanvas.com/t/simple-animation-blend/6784/5 "2018-05-01T16:00:33Z")

</div>

I only see the Box and a second GraphNode called RootNode, I’ve checked and this doesn’t move either.

```javascript
    var childEntity = this.entity;
    var parentEntity = childEntity.parent;
    this.children = parentEntity.children;
    console.log(this.children);

```

---

<div class="post-metadata">

**Author:** ![yaustar](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/yaustar/32/2268_2.png) [@yaustar](https://forum.playcanvas.com/u/yaustar)\
**Post date:** [May 1, 2018, 4:31pm UTC](https://forum.playcanvas.com/t/simple-animation-blend/6784/6 "2018-05-01T16:31:46Z")

</div>

Looks like there were several more children under RootNode. This is the ‘working’ version [https://playcanvas.com/editor/scene/607789](https://playcanvas.com/editor/scene/607789)

See app.js

(Note that I’ve unparented the Box entity)

---

<div class="post-metadata">

**Author:** ![SkitzFritz](https://forum.playcanvas.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@SkitzFritz](https://forum.playcanvas.com/u/SkitzFritz)\
**Post date:** [May 2, 2018, 10:21am UTC](https://forum.playcanvas.com/t/simple-animation-blend/6784/7 "2018-05-02T10:21:55Z")

</div>

Thanks that’s really helpful!

Out of interest how did you see the other nodes? Or was i just missing them. I was logging out the array but could only see two?

---

<div class="post-metadata">

**Author:** ![yaustar](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/yaustar/32/2268_2.png) [@yaustar](https://forum.playcanvas.com/u/yaustar)\
**Post date:** [May 2, 2018, 10:36am UTC](https://forum.playcanvas.com/t/simple-animation-blend/6784/8 "2018-05-02T10:36:30Z")

</div>

I logged the children and just kept expanding the children of the children etc in the console view.

---

<div class="post-metadata">

**Author:** ![SkitzFritz](https://forum.playcanvas.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@SkitzFritz](https://forum.playcanvas.com/u/SkitzFritz)\
**Post date:** [May 2, 2018, 3:02pm UTC](https://forum.playcanvas.com/t/simple-animation-blend/6784/9 "2018-05-02T15:02:26Z")

</div>

Must have just missed it. thanks for your help.
