kubric
kubric copied to clipboard
how to modify the velocity of objects
when I use challenges/movi/movi_def_worker.py, I find the velocity of dynamic objects is fast. How could I set it slower?
Hi there!
Line 31!
VELOCITY_RANGE = [(-4., -4., 0.), (4., 4., 0.)]
Change the range to be a lower range if you want to see lower velocities!
Example:
VELOCITY_RANGE = [(-4., -4., 0.), (2., 2., 2.)]
Edit 11/04/2022:
@log26 It's me again, Had another look through the file and found line 174
obj.velocity = (rng.uniform(*VELOCITY_RANGE) - [obj.position[0], obj.position[1], 0])
This would be where the individual Objects are assigned the velocity
Its inside a for loop that can be found on line 165
for i in range(num_objects):
Hope that provides even more detail
Another approach would be to change the frame rate (if gravity etc. is also too fast). MOVi uses 12 FPS so if you want to have half the (apparent) speed you'd set it to 24 instead:
scene.frame_rate = 24 # or pass --frame_rate=24 as a commandline arg
Just take care that the frame_rate
is an integer divisor of the step_rate
(the framerate of the simulation), which defaults to 240.
Hi, @Qwlouse I'm a bit confused about the frame_rate
and step_rate
. Say I set step_rate = 100
and frame_rate = 10
. Then according to the comments, I'll run the simulator 100 steps per second, and render 10 frames per second. So I'm rendering a 10FPS video. Besides, if I set frame_rate = 100
, I'm rendering a 100FPS video. Are these correct?
However, if I set step_rate = 1000
and frame_rate = 100
, I thought I'll get a 100FPS video, i.e. objects moving very slowly. But the video I get is actually similar to the 10FPS one above. This confuses me, cause I thought rendering frame_rate should be independent of the simulation frame_rate, but it turns out that they are somewhat related.
So I'm wondering if there is a formula to compute these values. Say I want to simulate a x
FPS video of length T
seconds. I'll set frame_rate = x
, frame_end = T*x
, and what about step_rate
?