J
Jacob
Guest
So i'm trying to make one of the bones in my character follow the mouse but it just ain't working. I even used the gamemaker test code to see if it would work then, but it didn't.
Here's the gamemaker code.(Put it in the step event)
var map = ds_map_create();
skeleton_bone_state_get("head", map);
var xx = ds_map_find_value(map, "worldX");
var yy = ds_map_find_value(map, "worldY");
var deltax = mouse_x - (x + xx);
var deltay = mouse_y - (y + yy);
var angle = -radtodeg(arctan2(deltay, deltax));
ds_map_replace(map, "angle", angle);
skeleton_bone_state_set("head", map);
ds_map_destroy(map);
"The above code creates a ds_map and then populates it with the data from the bone named "head". It then extracts the world position for the bone, and uses that data to set the "angle" of the bone to track the mouse position in the game."
I'm quite new to working with spine so i might be doing something terribly wrong. Thanks in advance
Here's the gamemaker code.(Put it in the step event)
var map = ds_map_create();
skeleton_bone_state_get("head", map);
var xx = ds_map_find_value(map, "worldX");
var yy = ds_map_find_value(map, "worldY");
var deltax = mouse_x - (x + xx);
var deltay = mouse_y - (y + yy);
var angle = -radtodeg(arctan2(deltay, deltax));
ds_map_replace(map, "angle", angle);
skeleton_bone_state_set("head", map);
ds_map_destroy(map);
"The above code creates a ds_map and then populates it with the data from the bone named "head". It then extracts the world position for the bone, and uses that data to set the "angle" of the bone to track the mouse position in the game."
I'm quite new to working with spine so i might be doing something terribly wrong. Thanks in advance