I've got characters made up of a body (includes feet), head, equipped chest and head etc all stacked together by Z and I'm having trouble grounding the characters in my scene without the use of physics.
I've got a Final Fantasy style screen so I've created spawn points in the form of GameObjects on the level and then use the following code to position them:
Bounds bounds = baseSprite.GetUntrimmedBounds();
AdventurerSpawnLocation apl = dungeonInstance.adventurerSpawns.Find(spawn => spawn.partyPosition == a.partyPosition);
Vector3 pos = apl.transform.position;
pos.y += bounds.size.y / 2f;
a.transform.position = pos;
This works out pretty well, but I'm having problems using it in paper dolls in character screens and other areas where I'm resizing the baseSprite at run time to mimic new races like dwarves, giants etc... I have a base sprite that has the whole body and then change the scale to 1.1 1.1 1.0 for example on a Giant as well as all equipped items.
Is there any better way to do this? Perhaps re-do all my characters with a new pivot at their feet so I can simply set position to the spawn point if the spawn point is at the ground location I want? The main issue is changing the baseSprite scale at run time and then maybe the bounds are not calculated correctly? Not sure why I'm getting results where the "feet" aren't at the same position.