Matter.Events.on(runner, 'beforeUpdate', (e) => {
Matter.Body.setVelocity(body, {
x: -2,
y: body.velocity.y,
})
})
Im setting the velocity like this. my problem is depending where i run this code it object moves in diffrent speed.
if i run it with node 16.4.0 on my local machine it moves the object super slow.
event log from my machine
{
timestamp: 949.9999999999992,
name: 'beforeUpdate',
source: {
fps: 38.873999999999995,
correction: 1,
deltaSampleSize: 60,
counterTimestamp: 1647108816311,
frameCounter: 19,
deltaHistory: [],
timePrev: null,
timeScalePrev: 1,
frameRequestId: undefined,
isFixed: true,
enabled: true,
delta: 16.666666666666668,
deltaMin: 16.666666666666668,
deltaMax: 33.333333333333336,
events: { beforeTick: [Array], beforeUpdate: [Array] }
}
}
if i run this code as example on a heroku machine wiht node 16.4.0 it has the speed which was intended.
event log on heroku
{
timestamp: 733.333333333333,
name: 'beforeUpdate',
source: {
fps: 1647108632.865,
correction: 1,
deltaSampleSize: 60,
counterTimestamp: 1647108632865,
frameCounter: 44,
deltaHistory: [],
timePrev: null,
timeScalePrev: 1,
frameRequestId: undefined,
isFixed: true,
enabled: true,
delta: 16.666666666666668,
deltaMin: 16.666666666666668,
deltaMax: 33.333333333333336,
events: { beforeTick: [Array], beforeUpdate: [Array] }
}
}
is also tried with or without fixed update
const runner = Matter.Runner.create({
isFixed: true,
})
what do i need to set that the move always at the same speed?
Via Active questions tagged javascript - Stack Overflow https://ift.tt/LnEeWQd
Comments
Post a Comment