- Home /
Alright, what about a grid?
Lets say I wanted to make a thing for survival or something, I would like it to be on a grid. Is it posable to make it so I raycast, on hit point, it instantiates a prefab, but it find the closest grid unity, and places it in the center of it? Also another question not needing a answer for now, how would I make it so I can detect if a object is using up a grid space that what I want to place is placing in? so I can plac 2 objects in the same grid space?
I already know how to instantiate, and raycast it to the hit, and I knowa little about mathf.round , But I am not sure how to do the rest.
Answer by alienbaby · Dec 04, 2013 at 05:48 PM
Is it possible to make it so I raycast, on hit point, it instantiates a prefab, but it find the closest grid unity, and places it in the center of it?
Yes.
how would I make it so I can detect if a object is using up a grid space that what I want to place is placing in?
You could keep track of what you put where and refer to that structure to determine the state of a grid cell, or you could utilize Unity's collision detection.
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Cube terrain with perlin noise 1 Answer
UnityEngine has no appropriate version problem 1 Answer
Singletons in music script? 2 Answers
2.5D ledge hang with javascript 0 Answers