Jump to content

Smoothing Out Car Animation


JohnK
 Share

Recommended Posts

The main reason for the playground is to produce an example for the guide on BJS that I am writing to show how translate, rotate, parent and setPivot can be used. After various struggles due to mistakes and lack of knowledge I have come up with this

http://www.babylonjs-playground.com/#102TBD#14 where you steer(?) the car (which has a set forward speed) with keys A and D

Issues are :

  1. The response to the keys only happens if after clicking on run the canvas is clicked on immediately afterwards ( and sometimes you have to do this again before it works)
  2. While a key is pressed down it interferes with the rendering (too much going on?)

If you think too much is going on then have a look back at earlier versions #10 for example.

It would be nice to have solutions to these problems but if not then as I can show the parts of the code I wanted to without the key control I will probably just go for a predetermined path for the car to follow.

Link to comment
Share on other sites

http://www.babylonjs-playground.com/#102TBD#16

Ok, it's a "hack" and not a solution.  But ya know, sometimes a guy just needs to take a nice drive in his new Porsche Trapezium... and have some think-time about the math in his renderLoop.  :)  Take over the wheel, JK... I have the radio set to the polka station.  Love them polkas!

A note for the youngsters:  Above, I have a version of John's car "working", but I bypassed the part that gave John's car... real precision turn-accuracy.  So, although I made John's car drive-able, I did it with duct-tape, seaweed, snot, and imprecision. 

I took John's diamond, and washed my pig with it.  :)  In other words... I "faked it", "kludged it", and generally screwed-up his demo.  I know John pretty well, and I know he will laugh it off, and get back to work on accuracy again.  I did not answer John's issue... at all.  Not even a little bit.  But he still likes me.  :)

Link to comment
Share on other sites

Glad to hear from you Wingy, I am not only going to laugh off your attempt but have a long laugh at my own which when looked at from a different perspective are no better than your simulation. If you take yours and increase camera height to into the 200s and re-attach the camera then you will see that your car more or less spins on the spot even though it looks OK from where I set the camera. If you take my latest attempt (http://www.babylonjs-playground.com/#102TBD#17) I have improved the response by moving some code about but looked at from above my car just does a crazy dance. So somewhere my application of the maths is wrong.

Of course I still like you and have clicked to say so to prove it. :D

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