Hello all,
I have problems finding the real height of my character in game.
This is some of what i have tried:
PlayerHeight = this.GetComponent<CharacterController>().height;
PlayerHeight = this.transform.collider.bounds.size.y;
PlayerHeight = transform.FindChild("ChildName").transform.localScale.y;
PlayerHeight = transform.FindChild("ChildName").GetComponent<MeshFilter>().sharedMesh.bounds.size.y;
PlayerHeight = this.transform.lossyScale.y;
PlayerHeight = this.transform.localScale.y;
I have tried out more possibilities, but havent kept track of the all.
I Have also tried to find values in the inspector related to the in-game height but I can only find Scale values.
But heres the thing, i have implemented a system to see how far the player is from the ground(Altitude) and that is 0 when I stand on the ground and the value increments when the player is ascending.
So since I’m able to calculate the height of the player from the world, shouldent it be possible to calculate the real height of the player from bottom to top?
I hope someone here is able to help me out
and sorry for all the spaces, the text editor have bugged.
EDIT:
I might add why i need the real in game height… I’m gonna use it to calculate fall damage and animations based on the size of the character insted of static values. Example: if (FallDistance > (CharacterHeight * 10) = Death.
Regards
Karl-Einarb
This isn't an answer to the question. Use the Comments section, it's not as if it isn't there.
– BlankBlank5454