• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By RoKabium Games
      While looking out for that pesky Terrator, our little alien is doing a bit of relaxed mining down on the new gas planet "Lelantos" this weekend.... 
      #gamedev #indiedev #madewithunity #screenshotsaturday
    • By vividgamer
      I have a native iOS game (objective c, XCode build) which I am considering to port to other platforms.
      Core gameplay is based on solely on geographical maps, and custom drawing over maps. It also has Core Data. This part is complete in development.
      What is not done yet is: monetization, gamification (leaderboards, challenges) and multiplayer functionality.
      As I think more about it, I am tempted to think if this is the right time to move to a cross platform tool such as Unity. But before dedicating time to port my 5 years side-project effort in Objective C, I really want to know if its worth it.
      - Does Unity support such plugins / assets that will fulfill all my above requirements?
      - Unity Personal seems to have only 20 concurrent users - is it too costly scaling if I decide for extending to web and android platforms?
      - What is the general workflow involved in publishing to iOS, Android, PC, and web platforms while using Unity? I mean to ask about various points of signing stuff, paying fees and getting certified.
      - How long will it really take to port my entire Objective C project into Unity? I am somewhat familiar with C# but I am finding it hard fidgeting with Unity IDE as lot of things are focused around FPS and 3D while my game is still 2d - not much action involved. I seem bit overwhelmed by the list of features I see there. All in all, I do not want to lose my momentum while still making sure its portable to everywhere.
      - Any assets I could use (for free to try basis in debug) that are relevant for my game?
      - Last but not the least, are there any costs that I need to be paying upfront to Unity, for using it (apart from their monthly subscription model)? I don't understand their costing for multiplayer in conjunction with their subscription fees - if someone could kindly elaborate.
      Thanks in advance for your time reading a newbie
    • By GytisDev
      me and few friends are developing simple city building game with unity for a school project, think something like Banished but much simpler. I was tasked to create the path-finding for the game so I mostly followed this tutorial series up to episode 5. Then we created simple working system for cutting trees. The problem is that the path-finding is working like 90% of the time, then it get stuck randomly then there's clearly a way to the objective (tree). I tried looking for some pattern when it happens but can't find anything. So basically I need any tips for how I should approach this problem.
      Use this image to visualize the problem.
    • By aymen
      please any know how can i' calculate the centroid from any number vertices
    • By Henry Fernandez
      Good day sir/maam. I am developing a game for my thesis and im done with multiplayer and plan to start the implementation of AI but i dont know how/where to start. Please give an advice. I am developing it in C# using UNITY. 
      Im am now collected all pieces that has possible moves but i am stuck on which best move to select. I hope you will help me. This is link explained the game https://en.wikipedia.org/wiki/Game_of_the_Generals 

  • Advertisement
  • Advertisement
Sign in to follow this  

Unity (view)Matrix questions

This topic is 2934 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, i'm reading tutorials and learning from codes on how to setup different sorts of cameras in XNA. Like Forst Person, Flight Cam, Free Orbit etc. But the example i'm following is using matrices in a way that i really don't understand. In this case he makes changes to the viewMatrix. I know how a matrix looks like and that its a 4x4 matrix. But i have no idea what the elements in a veiwMatrix represent. Take this code for example:
//cam setup
            eye = Vector3.Zero;
            target = Vector3.Zero;
            targetYAxis = Vector3.Up;

            xAxis = Vector3.UnitX; //1,0,0
            yAxis = Vector3.UnitY; //0,1,0
            zAxis = Vector3.UnitZ; //0,0,1

            viewMatrix.M11 = xAxis.X;
            viewMatrix.M21 = xAxis.Y;
            viewMatrix.M31 = xAxis.Z;
            Vector3.Dot(ref xAxis, ref eye, out viewMatrix.M41);
            viewMatrix.M41 = -viewMatrix.M41;

            viewMatrix.M12 = yAxis.X;
            viewMatrix.M22 = yAxis.Y;
            viewMatrix.M32 = yAxis.Z;
            Vector3.Dot(ref yAxis, ref eye, out viewMatrix.M42);
            viewMatrix.M42 = -viewMatrix.M42;

            viewMatrix.M13 = zAxis.X;
            viewMatrix.M23 = zAxis.Y;
            viewMatrix.M33 = zAxis.Z;
            Vector3.Dot(ref zAxis, ref eye, out viewMatrix.M43);
            viewMatrix.M43 = -viewMatrix.M43;

            viewMatrix.M14 = 0.0f;
            viewMatrix.M24 = 0.0f;
            viewMatrix.M34 = 0.0f;
            viewMatrix.M44 = 1.0f;

Can someone explain what is happening here? I can see he's changing the viewMatrix to this: 1 0 0 0 0 1 0 0 0 0 1 0 ? ? ? 1 Then he does the DOT product for each axis, x,y,z to see how much degrees it has moved?? And WHY is he altering the M41, M42 and M43 of the matrix?? Does it really matters which part he stores that data in? What would've happend if he stored it in M14, M24, 34, wouldn't that be the same? Hoping someone can clearify this for me. Thanks for any help.

Share this post

Link to post
Share on other sites
Well, what ways of using matrics do you currently understand?

Are you familiar with the idea of using matrices to represent transformations?

Share this post

Link to post
Share on other sites
I know how it can be done in XNA. Well sort of. But i'm not really sure how to transformation is exactly done. Like i said in my example, he's doing a transformation on the fields 'M41, M42 and M43' in the matrix. Why there..??

Well guess i don't know enough about them yet. I'll try to read more about this. But if you guys want to give me a good explanation aswell, feel free to do so :)

I also just ordered this book:
3D Math Primer for Graphics and Game Development

The reviews say that it's a pretty good book to give a good basic understanding about matrices and quaternions etc.

Share this post

Link to post
Share on other sites
honestly basic matrix math is very simple.

there are many ways of visualizing what a matrix times a vector is. The two most useful to me are a change of basis, and another which tells you basically how much your vector is along each row vector in the matrix.

[c1x c2x c3x vx
c1y c2y c3y * vy
c1z c2z c3z] vz
vx*[c1] + vy*[c2] + vz*[c3]

the column vectors of the matrix become the new basis vectors. So if you want to rotate a vector about an axis, you rotate its coordinate frame and put its column vectors into the matrix.

v = [vx, vy, vz]

[r1x r1y r1z vx
r2x r2y r2z * vy
r3x r3y r3z] vz

= [ dot(v, r1),
dot(v, r2),
dot(v, r3)]

in this case we see you can view the matrix multiplication by dot products of the row vectors of the matrix and the vector you are multiplying. If your rows form an orthonormal basis, what you have done is calculated an inverse for the matrix formed by making the rows into columns.


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement