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 Purri · Oct 07, 2011 at 09:55 PM · build3d

Sims like building script, picture and webplayer included

Hi,

Im currently doing game , and one element on that game is building rooms. Try this webplayer to see my current progress. Webplayer link HERE

As you can see, you can build "walls" (way too big ) by clicking any free tile on grid. But im looking for similar building system what sims games has. Check this picture alt text

First player click on any tile edge on game, see A. then player will move mouse cursor to the B, and there appears"ghost" wall between point A and B , if player clicks second time, real wall appears.

How to do it? I have tried to find a logic behind this but looks like i cant figure this out without help. Im not asking that you write code to me , im asking you show me the way or give idea how to continue!

Please, help me :(

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 Purri · Oct 08, 2011 at 07:25 PM 0
Share

Yes indeed i have 2 prefabs for walls , and marker is underwork, its not problem. But now main problem is how i draw that path from point A to point B and how to allways snap build marker on corner of tile?

I hope you guys can give answers !

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by roamcel · Oct 08, 2011 at 06:33 AM

My approach to this would be to actually use two different classes for the 'wall'. The first class is the 'ghost wall', and the second one is 'real wall':

  • click once, place construction marker, enter 'ghost wall mode' (something like just toggle keeping your mouse down in your app)

  • you actually create a rectangle of ghost prefabs (could even just be a transparent version of the 'real' prefab) from the 'marker' up to the mouse cursor

  • when you click again, you copy the 'path' of ghost wall to a path of real walls, so basically you can even possibly make both walls subclasses of 'wall'. then exit ghost mode.

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

Answer by TheKusabi · Jun 22, 2013 at 01:50 AM

A* path finding will allow you to build the walls from point a to point b. As for snapping the marker, you can either set the XYZ to that of the tile, or just round the number to the nearest multiple of the grid's cell-size.

Hope you get it working, I'm currently doing a lot of research into the elements of a Sims-like game.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

What is wrong with this? 1 Answer

A node in a childnode? 1 Answer

Variables correct in editor, But being reset in build? 0 Answers

Distribute terrain in zones 3 Answers

New C# scripts fail to build 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