S
ScaryPotato
Guest
Video of spinning wheel
GML:
/// @description Creating multiple spinning instances
phy_position_x = room_width/2;
phy_position_y = room_height/2;
col = make_colour_rgb(217, 87, 99);
render_flags = phy_debug_render_shapes | phy_debug_render_joints | phy_debug_render_coms | phy_debug_render_obb;
var i;
for (i = 0; i < 16; i += 1)
{
var
locationX = lengthdir_x(175, (22.5*i)+11.25),
locationY = lengthdir_y(175, (22.5*i)+11.25),
pocketMaker = instance_create_depth(x+locationX, y+locationY, -1, oPocket),
pocketFix = physics_fixture_create();
pocketMaker.phy_rotation = 78.75 - (22.5*i);//Setting oPocket instance angles
switch (i)//Setting point values for different oPocket instances
{
case 0:
case 8:
pocketMaker.pointValue = 5;
break;
case 1:
case 9:
pocketMaker.pointValue = 10;
break;
case 2:
case 10:
pocketMaker.pointValue = 15;
break;
case 3:
case 11:
pocketMaker.pointValue = 20;
break;
case 4:
case 12:
pocketMaker.pointValue = 25;
break;
case 5:
case 13:
pocketMaker.pointValue = 50;
break;
case 6:
case 14:
pocketMaker.pointValue = 75;
break;
case 7:
case 15:
pocketMaker.pointValue = 100;
break;
}
physics_fixture_set_box_shape(pocketFix, 21, 1);
physics_fixture_set_density(pocketFix, 0);
physics_fixture_bind(pocketFix, pocketMaker);
physics_fixture_delete(pocketFix);
physics_joint_revolute_create(id, pocketMaker, phy_position_x, phy_position_y, 0, 0, false, 1000, 0.2, true, false);
var
locationXX = lengthdir_x(176, 22.5*i),
locationYY = lengthdir_y(176, 22.5*i),
blockMaker = instance_create_depth(x+locationXX, y+locationYY, -1, oBlocker),//Creating oBlocker
blockFix = physics_fixture_create();
blockMaker.phy_rotation = 90 - (22.5*i);//Setting oBlocker instance angles
physics_fixture_set_box_shape(blockFix, 21, 1);
physics_fixture_set_density(blockFix, 0);
physics_fixture_bind(blockFix, blockMaker);
physics_fixture_delete(blockFix);
physics_joint_revolute_create(id, blockMaker, phy_position_x, phy_position_y, 0, 0, false, 1000, 0.2, true, false);
}
The code creates a slowly spinning wheel, made up of 16 pink bars, and 16 dark shapes.
Depending on the torque (1000) and motor speed (0.2) values used in physics_joint_revolute_create, the two types of instances seem to really bounce around and overlap each other.
Is there a way to make the two instance types move cohesively?
And is there a way to smoothly decrease/stop the spin of the instances, like the big wheel thing on Wheel of Fortune?
Thanks in advance for any help figuring this out!
~Edit~ Added link to video of wheel in motion
Last edited by a moderator: