Jump to content

Path animation and mesh position


dbawel
 Share

Recommended Posts

Hello,

I have several meshes on paths, and need to begin particle animations at specific locations on the paths. However, when I use the position of an object or child on the path to start the particle animation, the condition is never met. I assume that the transforms are not updated on path animations.

If I start the particle animation, it starts. But if I place it in a condition, in the same location in my script, the particle animation will not start. I'm using it on the same path which @JohnK helped me with last night::

if (mesh.position.y > 0) {

smokeSystem.start();

}

and mesh is on the path passing above 0.0 - which I've tried every axis and the particle system will not start.

 

If I use collisions by placing a cube on the path which my object must pass through such as:

    let abc = BABYLON.MeshBuilder.CreateBox(`abc`, { size: 5 }, scene);  
    abc.position = new BABYLON.Vector3(-50, 10, 100);
    
    if (vehicle.intersectsMesh(abc, true)) {
      
    smokeSystem.start();
    
    }

The particles will not start. But if I say smokeSystem.start(); in the exact same location, the particles start. I've spent hours on this, and tried everything I know. If anyone can help, please let me know as I have to finish this tomorrow.

Thanks much,

DB

Link to comment
Share on other sites

I updated the PG scene @JohnK was kind enough to build last night. If you un remark the smokeSystem.start(); you'll see it works. But I need the particles to only start near the top of the heart, and then stop before the bottom:

https://www.babylonjs-playground.com/#72C7CT#2

Any thoughts would be very helpful. 

@Deltakosh - do you have time to look at this? I really need help today, as I've wasted hours on collisions, GetAbsolutePosition, and everything else I can think of.

Thanks much,

DB

Link to comment
Share on other sites

@MarianG-

I tried several conditions similar to this, but didn't get it right. Thank you very much for taking the time to answer and to update the PG. Between you and @JohnK, you helped add a key component to the project which was as frustrating as I've yet encountered. I missed the logic needed to execute this, and I wish you lived closer to San Diego, as I'd definitely buy you and John a beer - or two. Thank you again for your help.

Cheers,

DB

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