Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 imranmouna · Apr 09, 2017 at 05:36 AM · orientationduplicateplacementfilldistribution

What is the best way to evenly distribute objects to fill a curved space?

I have been struggling to find an elegant way to fill this seating area with chairs. I've tried using splines, but I still end up having to do a lot of individual rotation to orient all the chairs towards the same focal point. Is there a better way to go about this? Any help would be greatly appreciated, I've been at this for days...

alt text

UPDATE: I found this code which has taken care of rotating the chairs so they target the same focal point. But I'm still curious if there are any better methods to do this.

 //C# Example (LookAtPoint.cs)
 using UnityEngine;
 [ExecuteInEditMode]
 public class LookAtPoint : MonoBehaviour
 {
     public Vector3 lookAtPoint = Vector3.zero;
 
     void Update()
     {
         transform.LookAt(lookAtPoint);
     }
 }
objectplacementproblem.png (114.0 kB)
Comment
Add comment · Show 2
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 ritoban · Apr 13, 2017 at 02:53 AM 0
Share

Are there any areas covered by itself (from the top direction) If the answer is no, I think you could just Raycast down from several points (possibly just a square grid of points) and spawn a chair wherever a raycast hits something on the ground layer. Let me know it you want the code for this.
Also note that your transform.LookAt function will rotate the chairs in all directions. If these are swivelling chairs, it may be preferable to turn them only on the y axis, which you could use Quaternion.LookRotation.eulerAngles.y

avatar image ritoban · Apr 13, 2017 at 04:27 AM 0
Share

If the problem is positioning the chairs, then it depends if you want to hand place it or procedurally. You can attempt what I outlined in the comment (raycasting to check it above the ground), but you're going to have to find some rule about how you want to arrange the chairs. If you give me an image of the arrangement you want, I might be able to help.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by AshAbeAdd · Apr 10, 2017 at 12:43 PM

Looks interesting. I'm not that experienced of a coder, but I was working on some waypoints about a week ago. While putting waypoints down, you can have vehicles move and rotate as require. Now I don't know how complicated you want to make your codes and seating arrangement, but it's definitely something you should look into. Maybe make several starting points in which you can add a bool if space is taken up, then you just need to draw the starting point to where you're looking at. You probably want to make sure that it doesn't move though. lol

Comment
Add comment · Show 1 · 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 imranmouna · Apr 13, 2017 at 02:38 AM 0
Share

Thanks for the idea, I'll look into it :)

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Which game portal websites accept Unity webplayers? 31 Answers

I finish a game and I want distribute it, what I need? 1 Answer

setting a character controller orientation by script 1 Answer

How to fix object orientation? 1 Answer

Is there a way to know the screen orientation when Screen.orientation == ScreenOrientation.AutoRotation? 2 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