Colliders not generated with Build Skeleton feature

Discuss issues pertaining to the various game/web runtimes of Creature here.
Post Reply
Galaxy9
Posts: 2
Joined: Sat Aug 31, 2019 2:22 pm

Colliders not generated with Build Skeleton feature

Post by Galaxy9 » Wed Oct 02, 2019 9:58 am

Hi, I'm using Unity and when I click Build Skeleton Objects in my character's GameController component it generates the children objects but the colliders aren't set and I get this warning message: "The collider did not create any collisions shapes as they all failed verification. This could be because they were deemed too small or the vertices were too close. Vertices can also become close under certain rotations or very small scaling."
I think at some point I tested the feature and it generated the colliders but that was a while ago since then I made several changes.

Some parts are hidden during certain animations using 0 opacity and 0 scaling, I tried removing the 0 scaling but still same issue so idk what else I can do to fix this, any ideas?

Edit: after pressing Edit on the colliders, I can see they're actually there but they're lines rather than rectangles (i.e their length/Y size is set to 0.0001)

chong
Posts: 1045
Joined: Thu Feb 19, 2015 2:21 am

Re: Colliders not generated with Build Skeleton feature

Post by chong » Wed Oct 02, 2019 12:51 pm

Hello,

I can investigate. But you can also take a look at the source to see what it is doing:
https://github.com/kestrelm/Creature_Un ... troller.cs

Under the function: CreateGameColliders(),

See how it creates it:

Code: Select all

        BoxCollider2D parent_collider = parent_obj.AddComponent<BoxCollider2D>();
        parent_collider.size = new UnityEngine.Vector2(simColliderWidth, simColliderHeight);
The size of the colliders are determined from simColliderWidth, simColliderHeight. You can see what those values are, should be useful for your case.

Galaxy9
Posts: 2
Joined: Sat Aug 31, 2019 2:22 pm

Re: Colliders not generated with Build Skeleton feature

Post by Galaxy9 » Wed Oct 02, 2019 3:36 pm

I just found out that you need to fill in these 3 fields before building the skeleton which were set at 0 since I'm used to make the Creature objects using empty GameObjects then adding the components. The fields are:
ColliderHeight, SimColliderHeight and SimColliderWidth.

I wasn't aware of this since I didn't come across it in the docs despite having read most of the relevant parts, either I missed it or it's not mentioned.

Now the colliders are set but the problem is that during the animation, their angles/rotations don't fit the visual objects they're attached to. After a quick look I found the issue came from the minus(-) in this line:

Code: Select all

Line 495: float setAngle = -(float)Math.Atan2((double)u_spawn_dir.y, (double)u_spawn_dir.x) * Mathf.Rad2Deg;
After I removed it the angles work perfectly.

Maybe it's a slight unnoticed mistake? Either way thank you for your hint things are right now ! :D

chong
Posts: 1045
Joined: Thu Feb 19, 2015 2:21 am

Re: Colliders not generated with Build Skeleton feature

Post by chong » Wed Oct 02, 2019 10:28 pm

Hello,

Thanks for the investigation and angle fix! I will take a look at it when I get the cycles again, but I did a simple test on my own example with the angles matching correctly. It might have something to do with the code not accounting for all possible object hierarchy layouts. Will need time to see what is going on and investigate further. In any case, this is why we provide the source for the runtimes ( and they are under the very liberal Apache license for even non Creature owners so you have a lot of freedom to modify/deploy the code however you want )

Cheers

Post Reply