View Single Post
Meteorite collision with ground
Old
djslater107
Administrator
 
Status: Offline
Posts: 178
Join Date: Jan 2007
Default Meteorite collision with ground - 05-25-2021, 10:11 AM

Without know the details of how you are implementing the meteorite motion, I have attached a very simple program in which a boulder "falls" to the moon surface, and when the collision happens, a changeDirection method is called that reorients the boulder to a new, random, direction.

In my program, my boulder would always be moving in a separate procedure, the collision detection just changes the direction it is moving.

To make the boulder stay on the ground, I created a Boolean variable for the Boulder class, canBounce and initialized into true. In myFirstMethod, my while loop checks this variable to see if it can continue moving or not. In my CollisionDetector, I Set this variable to false to stop the while loop.

(Also in the CollisionDetector I enabled / disabled the changeDirection procedure or the meeting the Boolean variable to false so you could see either option.)

I hope this helps.
Attached Files
File Type: a3p changeDirection.a3p (118.1 KB, 1 views)


Don Slater
Alice Team
Carnegie Mellon University
   
Reply With Quote