Hello, I’m pretty new to Phaser and physic libraries, so I’m unsure if my project can be done with matterjs.
It’s similar to the following: Evolving Genetic Virtual Creatures | Softology's Blog A “creature” made out of some rectangles as limbs, that should move by rotating it’s limbs at a specific frequency.
However, I don’t want the rectangles to always rotate 360°. It should be possible to set min and max values (e.g. a leg moves back and forth). From my research I found that many physics libraries (most based on box2d) have a min and max option, and even an included motor. Matterjs doesn’t.
For now, I only got the limbs to move by tweening. For example with the following:
this.tweens.addCounter({
from: 20,
to: 90,
yoyo: true,
repeat: -1,
onUpdate: (tween) => {
leg1.setAngle(tween.getValue());
},
});
But from my understanding, this sets leg1 always at a specific angle in the world, not at an angle in relation to another body. If the creature moves around, this angle won’t be correct anymore.
How would I be able to do that here? Or should I switch to another physics library?
Thanks for any help.