Jump to content

control object bounce


hunts
 Share

Recommended Posts

Hi again, hunts.

http://www.babylonjs-playground.com/#BEFOO#146

I removed 'chk' and I am resetting sphere height differently.  No biggie.

Lines 46-54... do the magic. We needed to remove sphere translation energy (position change) and sphere rotation energy (spin), because when it falls from pad... it is moving forward and rolling.  :)  When we move it to starting position, sphere still has all that energy, and it hits the pad at the same downward speed that it was traveling-at... when it hit .position.y < -50.  (very fast).

We needed to do a strange thing with ground.rotationQuaternion... to reset ground to flat.  (I added the pad rotation reset, but you might not want that).  :)

Generally speaking, when a mesh becomes physics-activated, it uses mesh.rotationQuaternion for rotation... instead-of the vector3/Euler mesh.rotation property.  Physics engines love Quaternions.  :)

Hope this helps.  Seemed to work okay for me.  Party on!

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