Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
Sign in to follow this  
tomtomsumsum

INSTANTIATE(spawn positions (x;y;z) )

Question

I made a script (C#) and want that my gameobject spawns at a random position near the object (tree)(radius of maximal 3) that gets destroyed  how can i doo this ?

HERE is the Scipt:

Please login or register to see this code.

i saw a video  but this was in javascript i hope anyone can help me

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0
Please login or register to see this code.

 

I used for a Please login or register to see this link. this function so as to randomize a vector3 in outer limit of a circle.

You can modify it, using a randomized radius - also I don't know what you are trying to do with the height. So adapt it according your project ++

Share this post


Link to post
Share on other sites

  • 0

i can show u what i mean : here is a video but because its in java script i dont know how to make it in c#Please login or register to see this link. (10:26)

Share this post


Link to post
Share on other sites
  • 0

You are destroying the gameobject(that has the script) then you are calling Instantiate? Try to instantiate first then destroy the gameobject

Edited by reaperkan

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...