Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Create and Manipulate Multidimensional Matrix[x,x] in Unity3D C#

Discussion in 'Scripting' started by eidercarlos, Jun 7, 2015.

  1. eidercarlos

    eidercarlos

    Joined:
    May 14, 2014
    Posts:
    9
    Hi Guys,
    I just wanna know how to create, for example, a 6x1, 6x3, etc. matrix (with float numbers) in Unity3D (C#) and do adding, multiplication and all matrix operations between the matrix created easily!


    I will be very gratefull by any help or sugestion!

    Thanks!!
     
  2. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
    razielblood and eidercarlos like this.
  3. eidercarlos

    eidercarlos

    Joined:
    May 14, 2014
    Posts:
    9
    Ok, thank you!
    How to declare, set and get values with a matrix created in a form float[x,x] ?
     
  4. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
    Code (CSharp):
    1. float[,] myFloats = new float[5,3];
    2. myFloats[0,0] = 1.0f;
    3. Debug.Log( myFloats[4,2] ); //max indices
     
    rads41668 and eidercarlos like this.
  5. eidercarlos

    eidercarlos

    Joined:
    May 14, 2014
    Posts:
    9
    thank you very much!!!