jkjyuio

Hi,

I'm building a point and click game. So i make some bounding boxes around my objects and want to "detect" them at runtime. Obviously, i need the hit detection to work whenever and object has been animated to a new location.

I've had a quick look at the runtime code, i'm using spine-c, and it looks like i could write code to rummage through the scenegraph and find them. There doesn't seems to be any dedicated function, for example;

Box getboundingboxbyname(whatever);

Or something useful like that. Or did i miss something?

Any help or pointers appreciated before i dive in and start hacking.

thanks.
jkjyuio
  • Bài viết: 5

Nate

The Spine Runtimes provide SkeletonBounds:
spine-runtimes/SkeletonBounds.c at 3.8

SkeletonBounds finds the visible bounding box attachments and gives you their world vertices, but you'll have to decide how to use them. Eg, you could transform a point from your scene graph / game world coordinates into the skeleton's world coordinates and then do hit detection. SkeletonBounds has some methods for such hit detection. Or, you could transform the bounding box vertices to your scene graph coordinates and do the hit detection there.
Hình đại diện của thành viên
Nate

Nate
  • Bài viết: 9847


Quay về Runtimes