Hi all.
I want to create a game like Knife Hit
https://www.crazygames.com/game/knife-hit
I create a circle at center, some items around it and move follow the circle.
I use Box2d physic for them.
let angel = pos * 360 / total; // i have 18 position around center circle
if (angel == 360) {
angel = 0;
}
let posX = Math.sin(angel * (Math.PI /180)) * IG.ITEM_COIN_RADIAN;
let posY = Math.cos(angel * (Math.PI /180)) * IG.ITEM_COIN_RADIAN;
item.revo = this.game.physics.box2d.revoluteJoint(circle, item, 0, 0, posX, posY, 0, 5e4, true, 0, 0, true);
Then when the knife hit the circle, i also make it move follow the circle
if (hit) {
knife.revo = this.game.physics.box2d.revoluteJoint(circle, knife, 0, 0, 0, -(this.game.height * 190 / 1280), 0, 5e4, true);
}
I set same motor speed. But the knife rotate faster items and it hits all items while the circle are rotating?
Position of the knife as also changes as well from it hits the circle
I want to keep knife and items have fixed position on circle and move with same direction and speed with circle.
Please help me
Thanks so much