need help with setOrientation script

i’ve just found that setOrientation won’t work with floats(i think) so i was wondering if anyone new of a script that would set the rotation using float values.
Can someone post a reply of a working version.

I don’t see a script…

There are a few things to keep in mind, however-
First off, I believe KX_GameObject.worldOrientation allows degree input, which is a lot easier than the usual 3x3 matrix.
What I usually do now, however, is to find a vector for one axis (usually +y) and use alignAxisToVect(). If you first do

alignAxisToVect([0,0,0],2)

to get the obejct oriented with the world axis, and then

alignAxisToVect(vec,1)

you can keep your object pointing up along the Z axis, which is usually preferrable.

I can give you a better answer once you’ve posted the script to see the problems in.

Ok heres the script so far.

import GameLogic
cont =GameLogic.getCurrentController()
own = cont.getOwner()

work = cont.getSensor(“changeloc”)
button = cont.getSensor(“actionbutton”)

if button.isPositive():
if work.isPositive():
cont = GameLogic.getCurrentController()
own = cont.getOwner()
own.y = GameLogic.yyy
y = own.y
own.z = GameLogic.zzz
z = own.z
own.x = GameLogic.xxx
x = own.x
own.zr = GameLogic.zzzr
zr = own.zr
own.player = 0
own.setPosition([x,y,z]);
setOrientation([,zr,])

all of it works but the setOrientation([,zr,]) ever when I try using numbers.

the entire file is in the post :Ladder climbing system

setOrientation, like AlignAxisToVect, are functions of an object- so it should be own.setOrientation

Also, a few points:
to call a variable, as of 2.49, use own[‘variablename’] instead of own.variablename. The latter will no longer work in the next version of Blender. Also, a bunch of functions, such as setOrientation, are going to be removed- now you want to use
own.worldOrientation=something. There’s a whole list of changes on the Blender website, under the 2.49 changelog.

Finally, [,zr,] will return an error, as there’s nothing in the first and last slots. [0,zr,0] will work as long as zr is a single number- if zr is an array, like [0,5,7], just use
own.worldOrientation=zr