Pixel-Composer/scripts/node_rigid_sim/node_rigid_sim.gml

39 lines
982 B
Plaintext
Raw Normal View History

2023-02-28 09:43:01 +01:00
function Node_Rigid_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) constructor {
2023-01-25 06:49:00 +01:00
name = "RigidSim";
color = COLORS.node_blend_simulation;
icon = THEME.rigidSim;
ungroupable = false;
update_on_frame = true;
collIndex = irandom_range(1, 9999);
if(!LOADING && !APPENDING && !CLONING) {
var _render = nodeBuild("Node_Rigid_Render", 256, -32, self);
var _output = nodeBuild("Node_Group_Output", 416, -32, self);
_output.inputs[| 0].setFrom(_render.outputs[| 0]);
}
//physics_world_update_iterations(30);
//physics_world_update_speed(100)
2023-03-02 07:59:14 +01:00
static reset = function() {
2023-01-25 06:49:00 +01:00
instance_destroy(oRigidbody);
physics_pause_enable(true);
2023-03-13 10:45:56 +01:00
var node_list = getNodeList();
for( var i = 0; i < ds_list_size(node_list); i++ ) {
var n = node_list[| i];
if(variable_struct_exists(n, "reset"))
n.reset();
}
physics_pause_enable(false);
2023-01-25 06:49:00 +01:00
}
2023-03-13 10:45:56 +01:00
static update = function() {
2023-03-02 07:59:14 +01:00
if(ANIMATOR.current_frame == 0)
2023-01-25 06:49:00 +01:00
reset();
}
2023-03-08 14:59:54 +01:00
PATCH_STATIC
2023-01-25 06:49:00 +01:00
}