BGE Object rotation question

Hello all!
Not sure of the right terms to describe this, but…

In BGE when I use this in a python script on my object -

LRotx = 30
obj.applyRotation([(LRotx), 0, 0], local)

the object seems to have a rotational force equal to LRotx applied to it, thus spinning forever insanely…

How can I make the object rotate to a certain angle and simply stay there?
As in - if LRotx = 45 the object should be rotated to 45 degrees

thanks much!
jd

make sure that line only runs once

Cool. makes sense.
I have info saved on my drive on how to format my python script to to run a command only “once” that i will dig thru…
Python is really a mind-screw for me, but is starting to make more sense…

Would you have any suggestions for best approach?

I have a constant flow of numbers via OSC from a Leap controller coming in (that part is all working great so far - I am getting the x/y/z positions just fine using worldPosition) , I am simply trying to get my object to clone/match the incoming hand angle.
I somehow sense that a separate script that only fires when a changed OSC number comes in might be the way…

thanks!
jd

If you want to rotate to a given angle in world space, then


from mathutils import matrix
from math import radians

def some_controller():
    theta = ...
    obj = ...

    # Set rotation
    rotation_mat = matrix.Rotation(radians(theta), 3, 'Z')
    obj.worldOrientation = rotation_mat