- Home /
How to instantiate an object and have it rise from/through the ground?
Hi all,
Could use some help. In the game I’m developing, the player uses earth control powers to attack and defend. I want to create a technique where the player raises a wall of earth to block attacks, but I’m having trouble figuring out the process.
Right now, I’m trying to instantiate the wall (block object) below the surface of the ground plane, and raise it up from the ground, but it’s either getting stuck halfway through or coming to the surface instantly.
Thoughts on how I should go about this?
Thanks!
Answer by imaginationrabbit · May 04, 2019 at 07:53 PM
You can instantiate/spawn it using the position of the floor- when it is instantiated the wall's local Y position is 0- then lerp/animate/tween the Y scale to 1 or whatever it should be- if you are blocking attacks using a collider the collider will scale and work properly this way as well.
Just make sure that when the wall is instantiated/spawned you set the local Y scale to 0 each time.