Hello,
I’m trying to make a wheel that realistically rotates and moves along the ground in Phaser 3.23 beta using the built-in Matter physics support.
From my research so far it looks like I need to be setting the angular velocity of the wheel, and everything else should happen automatically. However, the wheel remains completely stationary. It is not a static body (if hit by other objects it moves as one would expect).
This is the code I’m trying to test right now:
let velocity = 0.05; // 0.05;
velocity = Phaser.Math.Clamp(velocity, 0, 1);
const body = sprite.scene.matter.body;
// set angular velocity to wheels
body.setAngularVelocity(sprite, velocity);
console.log(sprite.body.angularVelocity);
The console statement repeatedly prints 0
, despite the angular velocity being set on the line above.
I’ve been looking around several different forums/sites for several hours now and I’m sure I must be missing something basic, but I’m not sure what. Most of the resources I’ve found are for the standalone version of Matter or Phaser’s arcade physics.
Does anyone know what I’m doing wrong?