Blender.Mathutils.Matrix causing Blender crash in game mode.

Game Engine, Players & Web Plug-in, Virtual Reality, support for other engines

Moderators: jesterKing, stiv

Post Reply
mbouchard
Posts: 0
Joined: Fri Dec 17, 2004 8:30 pm

Blender.Mathutils.Matrix causing Blender crash in game mode.

Post by mbouchard »

The following Python script causes Blender to crash in gaming mode:
----------------------------------------
import GameLogic
from Blender.Mathutils import Euler

co = GameLogic.getCurrentController()
owner = co.getOwner()

euler = Euler([0,0,0])
# This frequently causes a crash
owner.setOrientation(euler)

# Alternatively, I transform the euler angle into a matrix
# and still get a crash frequently
matrix = euler.toMatrix()
owner.setOrientation(matrix)
----------------------------------------

Is this a known bug?
Is it allowed to use the Blender library while in gaming mode?

Thanks!




z3r0_d
Posts: 289
Joined: Wed Oct 16, 2002 2:38 am
Contact:

Post by z3r0_d »

it generally isn't a good idea to use the blender module in gameblender because for one thing, it isn't included in the standalone runtime

but, if you really want to setOrientation of a 0,0,0 euler rotation, the matrix I can even remember

[[1.0, 0.0, 0.0],[0.0,1.0,0.0],[0.0,0.0,0.0]]

but anyway, you're calling setOrientation with a matrix, I'm pretty sure it hasn't been updated to use the [new] matricies lib blender comes with, convert it to a list first, it should work then

owner.setOrientation(list(euler.toMatrix()))

or don't use blender's matrix lib, and stick with lists of lists

mbouchard
Posts: 0
Joined: Fri Dec 17, 2004 8:30 pm

Post by mbouchard »

I want to perform more complex rotation than Euler([0,0,0]) ;-)
This was just a sample and because the Blender 2.35a has a bug with
initializing the x attributes in the Euler class (already fixed in the dev branch).

I will give it a shoot with converting to a list and let you know.

Thanks.

mbouchard
Posts: 0
Joined: Fri Dec 17, 2004 8:30 pm

Post by mbouchard »

Yes, blender does not crash anymore by converting the euler.toMatrix into a
list.

However, I still experience crash when I my .blend file with the autostart
flag on... I guess this is related to the fact when I start Blender this way,
the Blender python lib is not present?

alien-xmp
Posts: 0
Joined: Sun Apr 06, 2003 2:22 pm
Location: Wellington, New Zealand
Contact:

Post by alien-xmp »

The setOrientation method accepts a 3x3 matrix or a quaternion.

Post Reply