Jump to content

Object following an object by x and z only.


Borislav
 Share

Recommended Posts

Is that possible?

If I set it like that:

face.position.x = char.position.x

face.position.z = char.position.z

It will just stand still.

I currently have.

face.position = char.position

It makes the cube follow the mesh.

But, I want the cube on the head, but it is in the torso.

http://cityworld.16mb.com/levels/1/play/preview.html

 

Link to comment
Share on other sites

:)  Also, look at this...

face.setPivotMatrix(BABYLON.Matrix.Translation(0, -something, 0));

That can move a face/head up or down.

Also...  you can try fun things like...

face.position.y = face.position.y + 2;
face.bakeCurrentTransformIntoVertices();
face.position.y = face.position.y - 2;

Fun with pivot/origin adjustings.  :)

After you perform up/down pivotMatrix adjustments or move-bake-unmove actions like these, it is sometimes fun to animate around the X-axis. It can make you smile...

scene.beforeRender =()=> {
     face.rotation.x += .005;
}

Offset rotation.  Pendulum-ing.  :)  Good luck.  Hope this helps.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...