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 ChrisButler · Nov 25, 2012 at 07:12 PM · positionobjectrelativeyx

Object position in relation to another object

Once again still doing Othello, I have a game object (the game board grid) and the tokens. I'm trying to have the token get its XY from the grid object. I have them communicating but its handing it null values and thus I'm getting errors about it not being tied to an object. so my figuring is that if I can figure out the object's relative XY the error about it not being tied to an object will go away. Any suggestions?

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 MountDoomTeam · Nov 26, 2012 at 08:22 AM

I don't understand the question that well, if you have 2 objects, it's not possible that the position of one compared to the other is null, unless you're not referencing one of the object properly.

Anyway, in a Chequers type of game, the board should have a fixed position and you should use some fixed mathematics to calculate all the positions of everything I think?

I would have chosen to have each square of the board as an integer and the tokens positions always at one integer or another, then it's really easy to do the mathematics for comparing all the tokens relative to each other, get all items called token, compare them to the last one played, do some logic to see if there are any that are tracked by the last played taken in all directions around it, I am estimating the entire program in its simplest form would be about 100-200 lines of code excluding variables.

to make a board, probably just do black and white squares ultimately in fixed positions, either by hand or by a formula that does 64 squares alternating by 8 and by 2 colours...

then you don't really need to worry about the board,

just focus on tokens within set positions and deleting some after callinga loop saying- check lines in all directions and see if any tokens are trapped. For that, the tokens positions need formulas like-

if token position X equals token position X+1, variable tokensinline equals 2, etc.and proceed through the loop like +1, +2, +3

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 MountDoomTeam · Nov 26, 2012 at 08:25 AM 0
Share

it's funny that Chris Butler should ask questions about othello! I thought he was a polo player

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

11 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

Related Questions

How to create a GUI Text when reaching a point 1 Answer

X and Y positioning(buttons). How do they work and why does building the game change their positions? 0 Answers

GameObject.find and positioning 1 Answer

C#: Changing current position of an object in y. 1 Answer

need rotate when change position relative to char 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