setting velocity for matter.js object

Hi,
I’m trying to set the velocity for an object I want to move across the screen.
I’m doing it using the setVelocity method of the object.
I tried to move it at a speed of 10px/s, but I noticed it moved way too fast.
After some investigation, I added logs the the update method of the scene and noticed that the position of the object changes after update - multiple times in a second.

I changed the velocity with:
setVelocity(10, 0);

Am i doing it wrong?
Is there a way to make matter.js update the position every second and not every frame?

thanks :slight_smile:

:wave:

If you want position changes only once per second, you probably don’t want to use physics.

But for continuous movement, reduce the velocity. I think Matter uses meters per second somehow.

I want the position to change continously but I also want to specify the velocity in pixels per second.
(I read somewhere that matter.js uses a 1 meter = 1 pixel as the default ratio).

Am i just supposed to consider the FPS while specifying the velocity?

Seems Matter’s velocity is meters (pixels) per step or 1/60s. So try setVelocity(0.166, 0).

ok, I’ll try. thanks!