POV-Ray : Newsgroups : povray.advanced-users : Flying and bouncing debris : Re: Flying and bouncing debris Server Time
29 Jul 2024 14:24:35 EDT (-0400)
  Re: Flying and bouncing debris  
From: Rohan Bernett
Date: 29 Sep 2002 03:40:02
Message: <web.3d96ad80d26a61b2c571aa6c0@news.povray.org>
Tim: thanks for the help, it's certainly helping, but I still can't get it
to work. *sigh* Here is my code so far:
///===================
//#declare Time = clock;
#declare Time = 3.6;
#declare groundheight = 0;
#declare Gravity = 9.8; // 1.6
#declare elastic = 0.5;
#declare Actual_Position = <0,0,0>;
#declare Start_Position = <0,20,0>;
#declare Direct_Speed = <1.5,0,0>;
#declare Hit_time = 0;
#declare Actual_Direct_Speed = 0;

#declare Hit_time= -((Direct_Speed.y/Gravity)-sqrt(
pow(Direct_Speed.y/Gravity,2)+((2*Start_Position.y)/Gravity) ));
#debug "hit time="
#debug str(Hit_time,8,0)

#declare counter = 0;
#while (counter < Time)
 #declare Hit_time= -((Direct_Speed.y/Gravity)-sqrt(
pow(Direct_Speed.y/Gravity,2)+((2*Start_Position.y)/Gravity) ));

 #declare Actual_Direct_Speed = Direct_Speed - Time*Gravity*y;
 #if (counter > Hit_time)
  #declare Direct_Speed = Actual_Direct_Speed*<1,-1,1>*elastic;
 #else
  #declare Direct_Speed = Actual_Direct_Speed;
 #end
 #declare counter = counter + 0.1;
#end

#declare
Actual_Position=Start_Position+Direct_Speed*Time-y*.5*Gravity*pow(Time,2);

object{rock  translate Actual_Position} // okay, it's actually just a
sphere, for now
///=================

The two Time lines are for running the animation generation, and testing
certain points.

This is a lot harder I thought it would be. :-(

Rohan _e_ii


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.