Sign in to follow this  
ewanvalentine

I'm struggling to make a box mesh move correctly...

Recommended Posts

Hi folks, 

My first post on the forum, so hello all! 

I'm been playing around with babylonjs. My intention is to make a Red Alert style game, mostly just to improve my JS skills, and learn the basic concepts of game development etc. 

However I've struggled to find a best approach for moving meshes around a ground plane. I'm essentially trying to animate a block to move from a selected mesh's initial point, to a selected point. But the movements happen immediately, and feel 'buggy' in my example: http://www.babylonjs-playground.com/#OYE6Q 

Any help much appreciated! 

Cheers,

Ewan

Share this post


Link to post
Share on other sites
12 hours ago, Temechon said:

Hello, 

Welcome on this forum !

Here is your example: I used animations in order to make the box moving.
http://www.babylonjs-playground.com/#OYE6Q#1

And for the fun, I used an easing function here:
http://www.babylonjs-playground.com/#OYE6Q#2

Cheers!

Thank you so much! That's much smoother, that makes a lot of sense. One issue I'm having now, using animate. Is that, if I have a static mesh with 0 mass, other meshes can pass through them, if that makes sense... 

http://www.babylonjs-playground.com/#OYE6Q#4 

In that example, you can move the moveable mesh through the static mesh, instead of avoiding it. I tried a few different things, but couldn't find a clear cut answer anywhere. Any help greatly appreciated! 

Cheers,

Ewan

Share this post


Link to post
Share on other sites

The problem with animations in this case is that the physic engine is not updated.

 

You cannot directly use animations with physics objects because the physics engine has to control and apply constraints where animations just blindly force the position to a specific value

Share this post


Link to post
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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.