- Изменено
Quick question on PhysicsHingeChain hierarchy
Hi Harald :grinteeth:
I'm working on an enemy character who is a giant, and has 550 bones in its skeleton. I have 'tendril' pieces that are hanging off of various parts of its body that I set up as 2D physics chains. I was just doing some Profiling of the game, and noticed that the SkeletonUtility bones updating was taking a LOT of CPU. I went in and deleted all of the SkeletonUtility bones that weren't within the hierarchy of Skeleton Root Bone -> Physics Chain bones. So I was able to reduce it down to 60 SkeletonUtility bones (not including the actual physics chain bones) which is much better.
This enemy character has two heads that are on really long necks. The necks are 25 bones in a chain, and there are physics chain 'tendrils' hanging down from the heads.
I was wondering if it is necessary to have the SkeletonUtility hierarchy from Root Bone -> Chain bone? Could I instead just have a BoneFollower component on a gameobject that follows the bone that is the immediate parent of the physics-chain, or something like that?
Thanks for any info! :nerd:
Yes, your observations are correct, you can omit having the whole hierarchy as SkeletonUtilityBone
and instead use a BoneFollower
at the right place.
A SkeletonUtilityBone
component is using local rotations in both modes Override
and Follow
. If you look at the SkeletonUtility Platformer HingeChain Physics
example scene, you can see that the cape-root
has the Parent Reference
parameter at SkeletonUtilityBone
and the Connected Body
at the Joint
Component both set to the mantles Follower
GameObject (mantles
is the parent bone of cape-root
). Now the mantles Follower
GameObject has to be at the right location so that local rotations relative to it behave as expected. This location can be achieved by using a BoneFollower
or any custom component that places the GameObject at the location of the parent mantles
bone.
Thanks Harald!!
You're very welcome!