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 Jonathan07 · Mar 15, 2014 at 01:40 AM · arraymatrixinteger

Bigger matrix?

Hi, I'm new to matrix and I was looking into it because I would need one but all I could find was a 4x4. My use for a matrix would be storing the amount of slots a ship has for every weapon class from one to ten. The classes go from 1 to 10 and there are 20 ships so I would need to be able to access to lets say the amount of class 7 weapons that ship 11 can hold. Is that possible through a single variable/matrix or do I need a new integer with an array of 10 for every ship?

Thanks!

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

3 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by zharik86 · Mar 15, 2014 at 08:39 AM

Operations with matrixes 4x4 are intended for another. In your case it is necessary to create an array with necessary quantity of variables. For example(write on CSharp):

  int[] myMassiv = new int[10]; //One-dimensional array of integer variables at 10 cells in size. Indexes from 0 to 9
  Vector3[][] myVec = new Vector3[5][20]; //Two-dimensional array of Vector3. Minimum admissible address of myVec[0][0], maximum admissible address of myVec[4][19].

You can create any class and create an array of your elements of this class. For example, you have a class with the name myClass. Then:

 myClass[] myMassiv = new myClass[10];

Certainly, instead of the digits determining the size of an array, it is possible to use variables.

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 Jonathan07 · Mar 16, 2014 at 11:32 PM 0
Share

That seems to be exactly what I'm looking for. I will have to look deeper into the matter since a class is not verry clear to me but i have a good idea. Thanks a lot!

avatar image
0

Answer by itinerary · Mar 15, 2014 at 04:08 AM

Have a look at 2D Arrays http://www.dotnetperls.com/2d-array

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 Eric5h5 · Mar 15, 2014 at 02:15 AM

Those are two different concepts. A Matrix4x4 is a specific construct used normally for transform operations. You don't need a matrix, you just use arrays/classes.

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

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

Related Questions

Javascript array questions. 1 Answer

Recursive Tree Loop? How do i make the matrix-array? 3 Answers

IndexOutOfRangeException: Array index is out of range. 1 Answer

Error with an Array 1 Answer

As I compare 4 objects in an array? 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