|
I have say a series of 2-d planes that represent a brick wall, where each brick is separate 2-d plane. I have a prefab brick that is 3d, that I want to have seemingly 'pop out' of the brick wall and approach the screen. After it moves a certain distance on the z-axis towards the viewer I want it to be destroyed and then instantiate from a random 2d brick on the wall. How can I get it to instantiate from the position of a random object within the scene?
(comments are locked)
|
|
GameObject myObj = Instantiate(myPrefeb, plane.transform.position, transform.rotation); or you can set it after instantiating like this: GameObject myObj = Instantiate(myPrefeb); myObj.transform.position = plane.transform.position;
(comments are locked)
|
|
Assuming the bricks were all tagged with a tag called "Brick", you can do this:
Note that if the number of bricks doesn't change, you should do FindGameObjectsWithTag once and keep the results, rather than every time you want to get a new random position. Don't do drugs, kids.
Apr 22 '11 at 10:32 PM
Eric5h5
(comments are locked)
|
|
i Totally Agree With Yuh Juana !! THis SHit Is Fucking Stuppid !!!! >:O
(comments are locked)
|
|
A brick is an object used to build things dumb-asses not a airplane!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! get a fukin life nd stop trying to search for bricks peace out bitchesxDDDD
(comments are locked)
|
