WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-18-2014, 06:03 AM
performlabrit performlabrit is offline
Member
 
Join Date: Oct 2013
Posts: 77
How to fixing unpredictable physics with manual intervention?

Hello all,

I'm trying to run an experiment in which I need very predictable physical interactions between a bouncing ball and the ground. For example, if the ball is dropped from a known height, the ball should return to that height (no energy should be lost upon collision). This isn't the case if using the physics engine, no matter the bounce/density/hardness settings, energy is lost. This is because Vizard does not give full access to some of the physics sim parameters (CFM).

So I must come up with my own solution:

* When the ball is about to collide with the ground (on the next frame), turn off physics

* Manually simulate ball movement as it hits the ground and reflects.
There is no friction, so this is a simple 2 step process. Using pre-bounce position, velocity, and acceleration, I calc the ball's position when it reaches a height of 1 ball radius. Then, I reverse the vertical component of velocity and calculate the ball's new height after reflection, at the start of the next frame (a total of 16.7 ms later at 60 hz).

* On the next frame, turn physics back on. I wait a frame to avoid issues with prioritization.

Unfortunately, energy is still lost upon a bounce! I've had a second pair of eyes check my equations, and there don't seem to be any mistakes.

Any ideas?

- gD
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:48 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC