- Home /
Sprout object from a surface
I'm new to all this so this is probably an easy fix. I'm trying to make a gun that when shot at a surface, it sprouts a rock formation out of the surface. what's actually happening is the "rock" sprouts out in the direction the surface is going. (on a wall it sprouts up, on the floor, it sprouts towards the player.
You could try making use of https://docs.unity3d.com/ScriptReference/RaycastHit-normal.html to get the direction in which it should sprout, which I assume would be basically back towards the Player
if it's context sensitive, like you mentioned (walls going up, floor going towards the Player), then you're gonna have to figure out a way of deter$$anonymous$$ing what classifies as floor or wall
if everything is only horizontal or vertical, then you could just check via code if the Normal of the hut surface matches 1 of those, but if your floors or walls can have an angle, then perhaps you might want some way of tagging them as wall or floor.. be it object name, tags (though) or any other means that works for you
Your answer
![](https://koobas.hobune.stream/wayback/20220613001543im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Having camera attack upon spawning player? 1 Answer
ai spawning please help 0 Answers
Multiplayer. Destroying player object on Host/Server 2 Answers