Sorry, I was confused by this:

"(and yes, rotating [0, 1, 0] by [-90, 0, 0] should actually make make [0, 0, -1]) :)"


On 21/02/2013 9:46 AM, Peter Agg wrote:
Hum, seems to be giving me the same result.

vec = XSIMath.CreateVector3(0, 1, 0)
rot = XSIMath.CreateRotation()
rot.SetFromAxisAngle( XSIMath.CreateVector3(1.0, 0.0, 0.0), XSIMath.DegreesToRadians( -90 ) )
vec.MulByRotationInPlace( rot)
print vec.X, vec.Y, vec.Z
# 0.0 6.12323399574e-17 -1.0


On 21 February 2013 14:31, Stephen Blair <[email protected] <mailto:[email protected]>> wrote:

    vec = XSIMath.CreateVector3(0, 1, 0)
    #rot = XSIMath.CreateRotation(XSIMath.DegreesToRadians( -90 ),
    #                             XSIMath.DegreesToRadians( 0 ),
    #                             XSIMath.DegreesToRadians( 0 ))
    rot = XSIMath.CreateRotation()
    rot.SetFromAxisAngle( XSIMath.CreateVector3(1.0, 0.0, 0.0),
    XSIMath.DegreesToRadians( -90 ) )

    vec.MulByRotationInPlace( rot)
    print vec.X, vec.Y, vec.Z
    #  0.0 6.12323399574e-17 -1.0


    On 21/02/2013 9:21 AM, Peter Agg wrote:
    (and yes, rotating [0, 1, 0] by [-90, 0, 0] should actually make
    make [0, 0, -1]) :)

    On 21 February 2013 14:15, Peter Agg <[email protected]
    <mailto:[email protected]>> wrote:

        Hey all,

        I'm trying to rotate a vector in a Python Script and seem to
        be running into an odd block. For example: I want to rotate
        the vector [0, 1, 0] by [-90, 0, 0], which should make [-1,
        0, 0] (and does so if I test in ICE using a Rotate Vector
        node) but I can't seem to work out how to do this via scripting.

        What I tried:

        vec = XSIMath.CreateVector3(0, 1, 0)
        rot = XSIMath.CreateRotation(XSIMath.DegreesToRadians( -90 ),
        XSIMath.DegreesToRadians( 0 ),
        XSIMath.DegreesToRadians( 0 ))
        vec.MulByRotationInPlace( rot)
        print vec.X, vec.Y, vec.Z
        # 0.0 6.12323399574e-17 -1.0

        ...which makes me think that I've misunderstood what
        MulByRotation does!

        Any ideas?





Reply via email to