- Home /
Player morphing to different model
Hi everyone, I'm trying to make a Player which can morph to differents models.
For example, I have a "Human" model, which is a 1x2 cube, that can be morphed to a "Wolf" model, which is a 2x1 cube.
Human and Wolf have different moveSpeed, jumpHeight, and differents abilities.
I'm handling the transformation by putting both Human and Wolf model into a Player prefab, and switching from one to another with GameObject.SetActive(true/false).
Where I'm stuck is when the player should not be able to transform. For example, the Human model is close to a vertical obstacle, the player should not be able to transform into a Wolf, which is 2x1, so that the Wolf does not end half in the wall.
What I'm trying is to do is to create a CanMorph(GameObject targetedModel) which would return wether the player could or could not morph into the targetedModel (Human or Wolf for this example).
I'm using Raycasts instead of Rigidbody to handle the Physic. I'm stuck trying to get the inactive model size/BoxCollider in order to draw ray from where the inactive model would be and see if it would hit or not.
Thank you.
Your answer
![](https://koobas.hobune.stream/wayback/20220612192701im_/https://answers.unity.com/themes/thub/images/avi.jpg)