View Full Version : question about pausing movement of object
05-22-2004, 06:16 PM
Hi, I have an object which is moving down a 3d plain and I want to hit a button which will stop the movement of the object for about 3 secs. How do I do it? thanks.
05-22-2004, 11:37 PM
it depends on how you're doing it or how you would like to do it. one way would be to add to your event handler to pause for 3 seconds.
// pseudo code
if (key_pressed(SOME_BUTTON) )
// continue...look up timers and such - that should help you out.
05-28-2004, 04:41 AM
if he paused in the event handler, then everything would pause, even if he wanted other things moving in the scene. One way to do it is to check the current time when the button is pressed and to not move that specific object till 3 seconds is reached.
05-28-2004, 09:13 AM
Originally posted by godhand:
Hi, I have an object which is moving down a 3d plain and I want to hit a button which will stop the movement of the object for about 3 secs. How do I do it? thanks.// Place in keyboard routine
if (key_press == 'S')
object_state = 0;
glutTimmerFunc( 300 (time in milliseconds), my_timmer, 0); // restart object in X time;
// Place in routine where the ball is updated
if (object_state) update_object(); // Only moved when object_state is logic 1
// Timmer routine
void my_timmer(int te)
object_state = 1; // after X time restart object
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.