Unity + Spine Collision Detection

Source: Internet
Author: User

There are several ways to do collision detection in the course of the game that you are developing:
1. Add Collider to Unity only
This is the simplest one. After editing the skeletal animation in spine, import it into unity, so that the spawn bone can get the skeleton in spine and then add collider to the required bones. This method can also be used for simple collision applications, but it is not easy to use a complex one, such as the need to remove collisions at a certain frame, which is not possible. In addition, when editing collider, it is very difficult to outline the collision zone for the complex and changeable bone.

2. Add a dedicated collision bone to the spine
In spine, you can create extra bones (attach a solid-colored rectangular image as a collision area) for collision detection, so that you can scale these orthopedic old adjustment collisions at every frame of the K animation, and if you scale the bone to 0 then that frame actually doesn't have a collision field.
Of course, this method also has shortcomings, such a collision area will be scaled with the bone, but only with the rectangular collider, which is bound to be less accurate.
Note: When making bones, pay attention to the beginning of the skeleton to fall in the center of the solid color picture, so when adding collider in unity, the collider position will be correct, otherwise there will be offset.
3. Use the bounding box in spine
This is the best collision solution I have found at the moment. The spine can be added to the map bounding box, this box is actually a polygon, can be in the K animation when the shadow, can also be scaled with the texture of the bone, and even like mesh to drag his vertices to adjust the border, this method is very flexible, accurate, You can generate Polygon collider from bouding box after importing to unity.

Unity + Spine Collision Detection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.