Jump to content

How to move objects ( randomly , not all at the same time ) to a target , and then stop them ?


DellaFree
 Share

Recommended Posts

Hi everybody !

I've made this playground http://www.babylonjs-playground.com/#1PTVTW#1 ; as you can see, the "ships", start moving from a random position and finally arrive to the target position (the cylinder in the middle). I would understand some things: first,how can I stop moving the ships when they arrive on the heightMap, (imagine a ship that arrives on an island)? I use the actionManager , and , to understand how it works, I change the color from yellow to red,
but they change too early. Actually I would that they stop when they reach the island (and not that change color); but I don't know how I can do that. Also I would understand how can I move these ships not at the same time (in my PG, they start all at the same time),  but I would that they start moving in different time (with a random time);  for example : the first ship starts after a 1s, the second after 2s, the third after 1.8s etc.

Do you think that my approach is correct, or I should use another way to achieve these things ? All the suggestions will be appreciate :D
Again, thanks for all guys,

cheeers

Link to comment
Share on other sites

Hi @iiceman, thanks for your replay. That's excacly what I need :D It works fine. Really thanks. I think this topic is solved.

Just out of curiosity, I added a lots of ships on this PG http://www.babylonjs-playground.com/#1PTVTW#7, and I would like to know if there is a way to avoid that the ships arrive in the same position, and "crash" one against the other (some ships overlap).Is this possible?

Anyway, thanks a lot again,

cheers

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