Jump to content

Movement glitch babylon/cannon.js


wo997
 Share

Recommended Posts

First of all here is my project, controls are WASD and mouse.

http://playground.babylonjs.com/#11OMIX#26

I was wondering what is causing some kind of friction between the ground and a tank, try to press A or D for 5 seconds, it will not turn smoothly, I noticed that the glitch occurs when the tank is on X or Z axis (probably also on Y axis too but I didn't try). You can see that wheels are rotating propertly, there are no forces pushing the hull, just wheels are jointed to it. Any ideas?

Link to comment
Share on other sites

Hi,

that is a wonderful scene! Wow, very impressive.

To me it seems like the wrong calculation of the forces to apply. You are using somewhere sin-based calculation like tan (without getting too deep into the code) which resets when reaching the 0's of the axes. Does it make somehow sense?

 

Link to comment
Share on other sites

@RaananW Thanks. No, I'm not using any forces that are calculated with sin or tan functions, I am just setting the motor force of each hinge joint between wheels and hull to the value calculated with 2 parameters, speed and rotation, nothing special. Friction makes it moving. I tried to remove the turret but this doesn't change anything.

Link to comment
Share on other sites

@wo997 - so ,..

this drove me a bit crazy :)

It seems to be related to the forces calculations of the physics engine when the wheels are positioned where you positioned them. I am very disappointed  I don't have a better explanation!

Having said that! http://playground.babylonjs.com/#11OMIX#28 . if you put the wheels closer together (or if you make the hull a bit wider) it is solved.

Link to comment
Share on other sites

@wo997 Well, I didn't mean it would necessarily need to derive from your scene. In fact I think it would be better not to, as a minimal reproduction is ideal.

I mean, if you started with a minimal scene, like this:

http://playground.babylonjs.com/#24QL2E#0

what is the minimum that needs to be done to show the behavior? From your scene, I can't really guess if the bug is with how joints work, or how the motors work, or how the friction force gets transmitted through constraints, or what. 

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