Home Technical Talk

How to rotate a vector around another vector x degrees?

obliviboy
polycounter lvl 12
Offline / Send Message
obliviboy polycounter lvl 12
Hey maxscripters,

How can I rotate a vector around another vector x degrees in maxscript?

Maxscript exemple
staticVector = normalize (point3 1 1 1)
rotatingVector = normalize (point3 0 1 1)
x = 30
I wanna rotate "rotatingVector" around "staticVector" x degrees.

Thanks.

Replies

  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    This is total guess work but here goes
    --use static vector and rotating vector to derive a 3rd axis.
    
    finalVector= cross(staticVector,rotatingVector)
    
    --contruct a matrix 3
    -- rotating vector is in row2
    tm = matrix 3 staticVector rotatingVector finalVector centerOfRotatoin
    
    --rotate
    rotateX tm 90
    
    --extract the new vector
    rotatedVector = tm.row2
    

    I reitterate I havent tested this.
  • obliviboy
    Options
    Offline / Send Message
    obliviboy polycounter lvl 12
    r_fletch_r wrote: »
    This is total guess work but here goes
    --use static vector and rotating vector to derive a 3rd axis.
    
    finalVector= cross(staticVector,rotatingVector)
    
    --contruct a matrix 3
    -- rotating vector is in row2
    tm = matrix 3 staticVector rotatingVector finalVector centerOfRotatoin
    
    --rotate
    rotateX tm 90
    
    --extract the new vector
    rotatedVector = tm.row2
    
    I reitterate I havent tested this.

    thanks, but value value has "centerOfRotatoin"?
  • Xoliul
    Options
    Offline / Send Message
    Xoliul polycounter lvl 14
    position of the static vector around which you rotate
Sign In or Register to comment.