Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by MadJohny · Jul 22, 2013 at 10:55 PM · instantiatepositionpositioning

Instantiate in the right position

Hi! I just made a random enemy random spawner thingie, basically it chooses one of the different enemies and instantiates it at a random spawnpoint, the problem is hat they spawn where they shouldn't I mean, some go trought the ground some don't even touch it, anyway I can fix this? btw my instantiate line:

 GameObject enemyInstance = (GameObject) Instantiate (enemies[pickEnemy], spawns[pickSpawn].transform.position, spawns[pickSpawn].transform.rotation);
Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Benproductions1 · Jul 22, 2013 at 11:07 PM 0
Share

Obviously your spawns collection contains object that are in the wrong position according to you.

avatar image MadJohny · Jul 22, 2013 at 11:09 PM 0
Share

yeah, but different enemies have different size... and if I set it good for one enemy, the others will be wrong

avatar image Benproductions1 · Jul 22, 2013 at 11:14 PM 0
Share

Then you can just use the height of the "enemy" to deter$$anonymous$$e an offset. It's just some simple math and vector algebra.

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by fransh · Jul 22, 2013 at 11:19 PM

Either the pivot of your spawners, or the pivot of your enemies, or the combination of both is causing this problem i think.

Make sure that if you place a object in the scene, and you put the position to 0,0,0 it actually is on the right position, just as you wanted it to be if you would imagine a floor there on 0,0,0 as well for example.

If it is not, and the distance you must move the object to look correctly placed, equals the distance you see between your spawns and their spawn locations right now, than you found your problem.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to implement a system for "Road-Construction"? 1 Answer

Wrong particle and prefab spawn position 1 Answer

blocks being placed in an odd way 0 Answers

Not instantiating prefab in the right place after 2017 update 2 Answers

Keep instantiated GameObject's position while parenting it to another GameObject 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges