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 SJCooper · Jan 06, 2015 at 08:09 PM · rotationarraylerpgrid

I'm having trouble with grids and instantiating arrays of prefabs.

Hey people,

I'm a Noob, i'll admit it but i'm not ashamed to ask for help when I need it.

So my problem is threefold.I'm using C#

I'm trying to create a game grid where prefabs can be instantiated and then then rotated (by 90, 180, or 270 degrees), or swapped out at runtime.

the purpose of this is to have a game where we start with one tile with either 0, 1, 2, 3, or 4 exits on the sides of a plane ( think doors to a room) which can be rotated by the player and then set (cannot be rotated anymore).

After this i need to work out how to have the grid know where the doors are and instantiate rooms where the first room had doors but not where they didn't. I have a prefab of a room that rotates when the boolean set = false and cannot be rotated further when set = true.

and the third problem i can't seem to figure out is how to leap the rotation of the prefab, at the moment it just jumps. i tried rotate towards by adding an unrendered plane with a connected empty transform to control the rotation but then when i added it to the prefab its rotation is driven by the room tile and so one key press equals constant rotation.

any help would be appreciated and if you need me to be clearer ill try!

my lack of knowledge also means i'm not even sure if this is possible the way i have conceived so if i'm going about it the wrong way just say so and i'll rethink my strategy.

thanks in advance Simon England UK The World

Comment
Add comment · Show 1
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 Mmmpies · Jan 06, 2015 at 08:41 PM 0
Share

Really you need to ask these questions in separate questions. The idea is to make it so if someone has an issue they can search for that specific issue.

Also there are just so many ways of doing things, you say you've used C# so post the code that you're having trouble with in each question so people can work out what you're trying and how to fix it.

1 Reply

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

Answer by hexagonius · Jan 06, 2015 at 09:48 PM

First: use a two-dimensional array for the rooms if you know max width and height (also maybe to start with)

Second: have scripts attached holding eg bools for all four directions of your rooms. Check them on instantiation and spawn a room in the direction of the doors. But this will get very fast very complicated. Is there already a room? Is there already NO door, so a door is useless...

Third: lerp can interpolate vectors. Interpolate from eg vector3.right to vector3.up and set the rooms right vector to it, it should rotate. Or rotate by tiny amounts around the desired axis of a room (vector3.up?)

Thats some ideas I can provide.

Comment
Add comment · Show 2 · 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
avatar image SJCooper · Jan 08, 2015 at 04:25 PM 0
Share

thanks thats all i needed and i think that your ideas have set me on a good path. much appreciation.

avatar image hexagonius · Jan 08, 2015 at 04:34 PM 0
Share

please upvote so one can see this has been answered

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How to move a gameobject with same speed 1 Answer

Quaternion Rotation On Specific Axis Issue 0 Answers

Slowly Rotate to Look at 1 Answer

Cant slow down rotation Speed 1 Answer

Rotate multiple objects around a object, maintaining their own trajectory(not rotating their local forward vector) 1 Answer


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