|
|
Here are some equations you'll gonna need:
Considering Direct_Speed is the direction
the particle is flying with the vectorlength
representing the velocity the particle has,
Gravity being the amount of Gravity (in
m/s this'd 9.81), the path is calculated
like this:
Actual_Position=Starting_Position+Direct_Speed*Time-y*.5*Gravity*pow(Time,2)
;
To calculate a rebounce-position, you calculate when the y-component
reaches 0 (the height where the plane'd be) like this:
Hit_Time=-(Direct_Speed.y/Gravity)-sqrt(
pow(Direct_Speed.y/Gravity,2)+((2*Starting_Position.y)/Gravity) );
To make it clear what I've done: I just resolved the topmost equation for
the y-component and T. Since the equation looks like this:
we can change this to
which is the same as
and then we can use
t = -(p/2) +- sqrt( pow((p/2),2) + q )
So, when we now the instant the object hits the floor again, we need only
the
speed, and direction of flight at that instant. Then we multiply that vector
with <1,-1,1> to rebounce from the floor and multiply with some float (.9)
to lose some kinetic energy.
What's the direction/speed-vector?
Actual_Direction_Speed = Direction_Speed + Time*Gravity*y;
So, after we've calculated the time of hit, we can also calculate the
location by just putting the time back into the first equation. Then
we've got all we need: A new initial starting location, a new
speed and direction... And we can continue with the loop.
To do this properly in POV-Ray, you should set a loop
which checks the next hit (time). If a POV-Ray-Variable,
which keeps track of time (like clock*20 for 20 seconds),
is larger than the hit-time you calculated, the hit occured, and
the loop is run again.
I'll implement the code and send another reply then,
but you should get working already...
Regards,
Tim
--
Tim Nikias
Homepage: http://www.digitaltwilight.de/no_lights/index.html
Email: Tim### [at] gmxde
"Rohan Bernett" <rox### [at] yahoocom> schrieb im Newsbeitrag
news:web.3d895918d26a61b218ccf4f70@news.povray.org...
> Christopher James Huff wrote:
>
> >Try just using a scale factor for the percentage of kinetic energy the
> >ball keeps after bouncing. A superball (high-bounce synthetic rubber
> >ball) would be around 0.9, a rock more like 0.05. Take both the object
> >and the surface it hits into account (maybe the average of both
> >"elasticity" values). If you want a "stop" point, consider it stopped
> >when the speed (length of the velocity vector) drops below a certain
> >threshold.
>
> A code example would certainly help, and some info to go with it would
help
> even more. I haven't had any experience in physics simulations, yet. I
have
> made some simple animations of objects moving along splines, and a falling
> sphere, though.
>
> Rohan _e_ii
>
Post a reply to this message
|
|