• 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 Uriel_96 · Mar 03, 2011 at 11:53 PM · javascriptgridconnectionalgorithm

Find connections dont working

OK, I am trying to get connections(up, down, left, right) of the mesh and some knows at the final of the row (at the right) it cant say that the right one is a connection because it would be at the first one of the next row and backwards. So this works fine but when I set the final at the beginning of a row the variable p the values are not completely filled, this means some have a value 0. If someone want to try it an look what I am talking

function Start(){
p[finish] = 1;
nodevalue[finish] = true;
}
function Update(){
var mesh1 : Mesh = GetComponent(MeshFilter).mesh;
var nodes : Vector3[] = mesh1.vertices;
for(actualnum = 0;actualnum<nodes.length; actualnum++){
if(p[actualnum]==setvalue){
if(actualnum-subsize < p.length && actualnum-subsize>= 0){
if(nodevalue[actualnum-subsize]==false){
p[actualnum-subsize] = setvalue+1;
nodevalue[actualnum-subsize] = true;
}
}
if(actualnum+subsize < p.length && actualnum+subsize >= 0){
if(nodevalue[actualnum+subsize]==false){
p[actualnum+subsize] = setvalue+1;
nodevalue[actualnum+subsize] = true;
}
}
if(actualnum-1 < p.length && actualnum-1>= 0){
if(nodevalue[actualnum-1]==false){
if (actualnum % subsize != 0) {
p[actualnum-1] = setvalue+1;
nodevalue[actualnum-1] = true;
}
}
}
if(actualnum+1 < p.length && actualnum+1>= 0){
if(nodevalue[actualnum+1]==false){
if (actualnum % subsize-1 != 0) {
p[actualnum+1] = setvalue+1;
nodevalue[actualnum+1] = true;
}
}
}
}
}
if(actualnum >= nodes.length){
actualnum = 0;
setvalue++;
}
}
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

0 Replies

· Add your reply
  • Sort: 

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

2 Triggers, 2 scripts, need help communicating the two. 1 Answer

How to have Mobile Input for a desktop game in Unity 1 Answer

Get connected vertices 0 Answers

just one connection 0 Answers

Javascript for simple grid puzzle? 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