Mathutils????

Hi, i am moderately new to BPython…and i wasent sure where to post this…but anyway, I am getting along with my BGE Python pretty well i have done many basic scripts and now im starting to get into more complicated stuff. I was wondering if anyone could explain about the Mathutils Module? The link to the API descriptions is here.

http://www.blender.org/documentation/249PythonDoc/GE/index.html

Im going into grade nine this year, so i dont know if its just because i dont know enough math…but i was wondering if anyone could answer some basic questions.

PS: other people can post their questions about the module here too if they want too…
Questions:

  1. What is it?
  2. What can i do with it?
  3. What does it allow in the Game Engine.
  4. Is there a simple description of what the basic classes are?(Like i know what they are…But i need to know WHAT they are…)
  5. Am I the only one confused about this??
  1. It allows usage of advanced math functions

  2. You can use it to interpret/build rotation matrices, manipulate quaternion rotation, multiply vectors by matrices to translate points, etc. etc.

  3. It simplifies mathematical data manipulation for scripting to achieve interesting stuff and enable more control.

  4. http://www.tutorialsforblender3d.com/GameModule/MathutilsModule_1.html

  5. Unless you’re a postgrad with a large knowledge of both pure and applied math then I think you’ll be as confused as everyone else. Quaternions :spin: (Possible to learn, but be ready to wreck your head for a bit ;))

also note that in 2.5 mathutils types will be default in the BGE, (which means matrices will be transposed from what the are now), and euler angles will be in radians.

Im sorry…maybe i don’t know enough about math…because i didn’t understand a word you just said…

It’s very probable that in grade 9 you haven’t been introduced to enough math to fully use the mathutils module. I’m from the UK and am not familiar with US grades, but just googled and it seems you’re 14-15? In the UK education system, math students will start learning about vectors and matrices at around your age. If you look through your text books then you might well find that they contain information about vectors and matrices that you will be taught this year or next year. Quaternions are a completely different matter and usually aren’t taught until university level.

If you’re interested though then there’s nothing to stop you from learning what you need to know yourself. If you have a basic knowledge of algebra, trigonometry and locating points in space by using coordinates/vectors then you already know most of what you need to get started.

I’ve found that http://www.euclideanspace.com/maths/index.htm is a great reference for learning about 3d math. The whole site is very good at explaining all aspects of 3d world creation. Most of the information there is not directly relevant since it covers the creation of a 3d engine from scratch and most of the groundwork has been done for us by the nice Blender developers. :slight_smile: All of the information will provide you with an understanding of what goes on behind the scenes though.

Wikipedia is also a good resource, although I find that the explanations there tend to be a bit more technical and harder to follow.

Math is somethimes hard to begin with, but if you learn how to use the functions in Blender then you will have a good basis for your learning and comprehension. Learning from using is far more fulfilling and interesting than learning from books where the uses are often ignored and make things boring. If you don’t want to wait for a few years then you’ll have to do a bit of reading yourself. Good luck in your learning.

I took the advanced maths stream at my school at completely bypassed vectors and matrices, so I had to learn about vectors myself. A tip, don’t use wikipedia, it is really bad when it comes to maths. Wikipedia authors have a habit of over complicating things.

when you use vector’s and matrix types with mathutils you don’t really need to understand the maths behind it IMHO.

example…
world_vertex_loc = local_vertex_loc * object.worldOrientation

Most of the time I deal with a matrix like a black box and never actually deal with its components. so I wouldnt worry too much about the math side.

Never did any vector/matrix math at school either but its not too hard to pick up.