kubric icon indicating copy to clipboard operation
kubric copied to clipboard

how to modify the velocity of objects

Open log26 opened this issue 2 years ago • 3 comments

when I use challenges/movi/movi_def_worker.py, I find the velocity of dynamic objects is fast. How could I set it slower?

log26 avatar Apr 08 '22 06:04 log26

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

MrXandbadas avatar Apr 08 '22 09:04 MrXandbadas

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.

Qwlouse avatar Apr 21 '22 17:04 Qwlouse

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?

Wuziyi616 avatar Dec 16 '22 19:12 Wuziyi616