1
$\begingroup$

I'm new to bge, reading a tutorial on matrix, I downloaded the linked file, a very simple task, I'm supposed to go to bge, press P then press space in order to run the script. the problem is, it's not, I googled it to search for other examples, I thought may be I'm doing something wrong, but everywhere it says that this his how you do it, can someone please enlighten me.
I'm attaching the .blend

enter image description here
enter image description here

$\endgroup$
1
$\begingroup$

This code is from pre 2.49. I'm pretty sure it runs into an error.

Always have the console window open when running the BGE with python code. Otherwise you will not see errors caused by Python code.

Convert the above sample to (BGE 2.5 and Python 3):

import bge 

controller = bge.logic.getCurrentController()
owner = controller.owner

rotation_matrix = [ [0,-1, 0],
                    [1, 0, 0],
                    [0, 0, 1]]

sensor = controller.sensors["space"]

if sensor.positive:
    owner.worldOrientation = rotation_matrix
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.