GameMaker Spine and bounding boxes

J

Justinbaileynes1987!

Guest
I have had previous trouble with spine and using it with the already written code for the game I'm working on. Fortunately I've fixed those. Now id like to know about how to use multiple bounding boxes with spine I'm trying to have a main bounding box be fore most player interaction like walking around jumping etc. but i want a second box on the characters sword. thing is game maker sees both of these and treats both like on big collision mask. What is the best way to tackle this issue?
 

Attachments

Nocturne

Friendly Tyrant
Forum Staff
Admin
Create your own bbox collision checks using point_in_rectangle or collision_rectangle.
 
J

Justinbaileynes1987!

Guest
thanks ill check it out today and see what it does
 
J

Justinbaileynes1987!

Guest
ok so i looked at both of those codes and im not sure how they apply to bounding boxes in spine since you have to define the collision box in the script

collision_rectangle( x1, y1, x2, y2, obj, prec, notme );

x1 The x coordinate of the left side of the rectangle to check.
y1 The y coordinate of the top side of the rectangle to check.
x2 The x coordinate of the right side of the rectangle to check.
y2 The y coordinate of the bottom side of the rectangle to check.
obj The object to check for instance collisions.
prec Whether the check is based on pixel-perfect collisions (true = slow) or its bounding box in general (false = fast).
notme Whether the calling instance, if relevant, should be excluded (true) or not (false).

point_in_rectangle(px, py, x1, y1, x2, y2);

x1 The x coordinate of the left side of the rectangle to check.
y1 The y coordinate of the top side of the rectangle to check.
x2 The x coordinate of the right side of the rectangle to check.
y2 The y coordinate of the bottom side of the rectangle to check.
obj The object to check for instance collisions.
prec Whether the check is based on pixel-perfect collisions (true = slow) or its bounding box in general (false = fast).
notme Whether the calling instance, if relevant, should be excluded (true) or not (false).
 
What I did to get around that issue is I created bone points (bones with length 0) attached to the bones I wanted hit boxes for. They move with the animation and you just have to read their position to set your custom hitbox system up. Its a lot more work setting it all up but it works well.

You could even just create a hitbox object to follow sword and probably don't need to add extra bones to make that work. Just read the position and angle of the sword.
 
J

Justinbaileynes1987!

Guest
Ive actually been looking at that using ds_map like it says in the manual to read bone position thing is its not working, i don't think its storing the data.

my idea that i think might work is to copy the bone data from the player animations and make an animation that is just the sword floating around. from there i give it to another object that will serve as the hit box and since its copied from the sword it should mirror it perfectly. all thats left its to create it invisible when the attacking animations are playing.
 
J

Justinbaileynes1987!

Guest
What I did to get around that issue is I created bone points (bones with length 0) attached to the bones I wanted hit boxes for. They move with the animation and you just have to read their position to set your custom hitbox system up. Its a lot more work setting it all up but it works well.

You could even just create a hitbox object to follow sword and probably don't need to add extra bones to make that work. Just read the position and angle of the sword.

ok so i tried it and it doesnt work.

i think finding the location of a bone and placing an object to serve as hitbox will work the best can you run me through how that works?
 
D

deanbrenden93

Guest
I'm also trying to figure out how to find the coordinates of a bone, but can't get it to work right. It's probably me being a doofus though.


New
I've got in a create event:
lamp_map = ds_map_create();

and then in the animation update event:
skeleton_bone_state_get("Lamp", lamp_map);
global.lampx = ds_map_find_value(lamp_map, "worldX");
global.lampy = ds_map_find_value(lamp_map, "worldY");

But it only returns 0.
 
Top