GameObject to follow player but constraint in a box
Hello,
I m desperately trying to spawn an object that is at the same time always trying to be as close a possible to the player, but with position constraint to the limit of a box (or whatever shape). Should I use a box collider ? I ve seen answers involving maths clamps and bounds, but I just cant figure out how to put the pieces together.
Thank you !
Answer by ClearRoseOfWar · Jan 08, 2016 at 07:00 PM
Not trivial... But heres some theory for you:
Instantiate. Place the spawn at the players x,y,z pos PLUS (or minus) a random amount (being the random distance from the player) then check to see if that spawn is in a wall or some other obstacle, and finally do a raytrace or something to the nearest open area closest to the player.
Your answer
Follow this Question
Related Questions
Add collision to mesh 0 Answers
How to reference a GameObjects Box Collider true in a if statement! 2 Answers
Box cast issue 0 Answers
My Click and drag object moves slowly after I drop it 0 Answers