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)
Colliders not generated with Build Skeleton feature
Re: Colliders not generated with Build Skeleton feature
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:
The size of the colliders are determined from simColliderWidth, simColliderHeight. You can see what those values are, should be useful for your case.
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);
Re: Colliders not generated with Build Skeleton feature
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:
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 !
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;
Maybe it's a slight unnoticed mistake? Either way thank you for your hint things are right now !
Re: Colliders not generated with Build Skeleton feature
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
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