Mathutils types for the BGE in 2.5

Hi, just spent some time updating Mathutils vectors so the game engine can use them and committed support for this into Blender2.5.
I have seen some complaints that relate to this so thought Id post here.

loc = gameOb.worldPosition
loc[1] = 0
gameOb.worldPosition = loc

can now be…

gameOb.worldPosition[1] = 0

You can ofcourse do stuff like…

other.worldPosition = (ob1.worldPosition+ob2.worldPosition)/2

and swizzle (from 2.49 thanks to z0r!)…

other.worldPosition.zxy = ob.xzy

when more types use mathutils

other.linV= (ob1.position-ob2.position).normalize()*0.1

This is going to break games that rely on values being new lists.
Will convert quats, eulers and matrices next.

Original commit log

interesting… btw, when is the next Genius Club meeting? lol not that I was invited, Chaser and martinsh wanted to know

I don’t get it. I can use it already in 2.49a official release, or wait till 2.5?

You can use Mathutils in 2.49 but you need to convert every time since the BGE in 2.49 returns lists.
vec = Vector(own.worldPosition)

As well as being slower and a hassle, you cant do…
Vector(own.worldPosition).x = 1

Mathutils integration means you can do…
own.worldPosition.x = 1

is this in 2.49a release?

no, in the 2.5 branch

Wrote a more formal proposal, <insert complaints here>

Sounds much easier to use… but complex to fix…

I’m all for it if the slowdown is not too much. Though it’s a little more than what I wanted, which was that the properties just returned Mathutils types.

sorry to bring this post back but I thought that it deserves attention.
I am not sure that I understand everything well, but this is supposed to help us cleaning scripts that make a big use of “alignAxisToVect”, “getVectTo”, etc…, right?

  • Does it allow for even more things that are out of my scope?
  • Is it supposed to work already? (builds on graphicall)

Thank you