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 Uriel_96 · Jan 27, 2011 at 01:21 AM · javascriptmeshinteger

Remove int[] element

Hi, I have an integer that is something like this:

var verts : int[];
var vertices = mesh.vertices;
for (int i=0; i<vertices.Length; i++) {
verts[i] = vertices[i];
}//this is only an example

but what I want is actually remove some vertices lets say 3,4 and 5.(this is only an example) So I want something that search for that number in the size of the length of the array and remove that element and the others that are bigger than that size cross it 1 number. Example:Lets say I want to remove the element 2 I want in the script to search for it, remove the element 2 and finally cross it 1 number. Something like this:

Element0 = 0,0,0 Element1 = 1,0,0 Element2 = 1,0,1 Element3 = 0,0,1

change it to:

Element0 = 0,0,0 Element1 = 1,0,0 Element2 = 0,0,1

Note: someone could say why you don't easily add if(i >=3 && i <= 5){ but as I say this is an example, that's not the finality of doing this.

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
1
Best Answer

Answer by DaveA · Jan 27, 2011 at 01:34 AM

var verts : int[];
var vertices = mesh.vertices;
var j : int = 0;
for (int i=0; i<vertices.Length; i++) {
  if (vertex is ok to copy)
    verts[j++] = vertices[i];
}//this is only an example
Comment
Add comment · Show 5 · 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 Uriel_96 · Jan 27, 2011 at 01:49 AM 0
Share

what do you mean with vertex is ok to copy?

avatar image DaveA · Jan 27, 2011 at 02:35 AM 0
Share

Whatever you meant by "something that search for that number in the size and remove that element and the others that are bigger than that size cross it 1 number." I assume there will be some test for some vertex size. If it's simply avoiding vertices 3,4 and 5 then it would be if (i >=3 && i

avatar image Uriel_96 · Jan 27, 2011 at 03:26 AM 0
Share

the thing is that I'm trying to search for the : if (vertex is ok to copy). That part is actually what I want to know.

avatar image DaveA · Jan 27, 2011 at 03:52 AM 0
Share

I'm sorry. I don't understand the condition you want to test for. When you say 'size' do you mean the magnitude of the vector? Distance? Or the values of x, y, and/or z being over some limit? Or length of the array?

avatar image Uriel_96 · Jan 27, 2011 at 09:27 PM 0
Share

I mean with the length of the array

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

No one has followed this question yet.

Related Questions

Can someone help me fix my Javascript for Flickering Light? 6 Answers

Setting Scroll View Width GUILayout 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Get integer or float value of a variable 2 Answers

Help me use Triangulator.cs (from wiki) with javascript 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