• 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 EscTheCtrl · May 27, 2015 at 01:26 AM · randomprocedural generationinfiniterunner

2d Random object placement help?

So, I have a game I'm working on that I want to be an endless runner, but I want the obsticles to be randomly placed... Basically the game is you going down a snowy slope and you have to avoid trees, Being an endless runner type of game, I want the obsticles to be Randomly placed only thing is, I'm not sure how I would do this, I tried making 3 different areas that stuff could spawn (Left and Right Edges that spawns very thick obsticles, then the Center that spawns very few.) But this caused basically a strait line of trees and rocks and looked very Linear.. I'm kind of hoping for something looks like the picture below.

alt text

If anyone has any ideas on how I could go about doing this, or any tutorials that would show/explain how to do something like that I would really appreciate it! Thanks!

screenshot-1.png (73.1 kB)
Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by cjdev · May 27, 2015 at 02:12 AM

One method of generating a look of pseudo-randomness is to separate your random placement into segments to create a more distributed look that still preserves the feel of unpredictable variation. It's a little hard for me to describe so I made the following image to illustrate:

alt text

Basically, you create sections and populate those with your random points in order to control the density of points in any given area. In your application you could have areas in the middle of the lane have fewer points spawn but areas on the borders have greater points spawn. The edges of your course would be defined by the position of whatever shapes you chose to contain the portions with the highest density of points (the 'Many Random Points' boxes in the image above).

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

21 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 avatar image avatar image avatar image avatar image

Related Questions

Spawning objects in infinite scroller game 0 Answers

Infinite Runner Tutorial - Destroyer Problem 2 Answers

Infinite runner world creation 2 Answers

What code do I need to randomly place terrain on my map when someone pushes play? 0 Answers

Random Generating 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges