Jump to content

How to make a sprite to track with a mesh?


klaude
 Share

Recommended Posts

Hello, guys.

I'm newbie on 3d programming.

I want to display sprite like GUI that has a function linkWithMesh. but it hasn't.

In this example,  sprite's position from a mesh is changing, not fixed.

https://www.babylonjs-playground.com/#87HQN6

the mesh must have BILLBOARDMODE_ALL.

how to make sprite to track mesh's position like GUI's linkWithMesh.

 

Link to comment
Share on other sites

Howdy! 

Welcome to the forum.

Even thou sprite looks 2d, we are 3d in our core. You will need to update the position in all axes in order to place the sprite on top of the mesh. Here is an example how it can be done: https://www.babylonjs-playground.com/#87HQN6#1

If dealing with different types of nodes, ou could also use the parenting system (http://doc.babylonjs.com/tutorials/position,_rotation,_scaling , search for parenting).

 

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...