Stop moving after few seconds??
Hello all,
I'm trying to develop a application but now, I've got a problem: I shoot a ball against other balls and then these balls collide. Like a billiard game. These balls are not on a table, they fly across the air. Therefore I set the gravity to [0,0,0]. This works very fine. But now the problem is that the balls are flying too long. It takes about 10 seconds till the balls stop moving. But I don't want to wait such a long time. The balls should stop moving after 3 seconds. Is this possible? I searched the whole Vizard Documentation, but I can't find the relevant command. I would be very pleased about every information and help. Thanks a lot! Chrissy PS: Sorry for english mistakes |
the sound like you have to use timer. Could you please looking at vizard functions because vizard has a timer function.
hope this helped you! |
But I only initiate the shoot. Afterwards the balls move automatically.
Where do I have to set the timer? My code to initiate the shoot is: Code:
vec.setLength(vizmat.Interpolate(1,400,power.get())) |
to shoot balls each time, try to define a shooting function, may be something like this
HTML Code:
def shoot(): let me know if this helped you. |
Hi,
no - I don't think that's my problem. Look. I've got one white ball and 14 other balls. Then I shoot the white ball against the other balls. Code:
vec.setLength(vizmat.Interpolate(1,400,power.get())) And now it takes about 20 seconds, until all balls will stop moving. And thats my problem. Is there a command, like "stop moving all objects" or something like that? |
You could loop through all your objects and set their velocities and angular velocities to zero.
Code:
for i in range (len(objects)): |
Hi Jeff,
thanks for your answer. This is exactly my problem. Great! Is it possible to slow down the balls, so that they don't stop fitfully? Thanks a lot. |
Is there no idea to slow down the balls steadily?
|
You could apply a small force opposite the direction the ball is moving. Here a function is called ten times, the first nine times getting the velocity of the ball and applying a small force opposite to it. On the tenth time the ball is stopped completely.
Code:
import viz |
All times are GMT -7. The time now is 10:20 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC