|
Post by anska on Jan 5, 2017 11:41:07 GMT -5
Hello, for an object I am working on, I would like to rotate a deco slot by 10° around the x axis. From looking at previous threads discussing the topic I have gathered, that I will have to change the orientation of the bone in the rig tab and modify the transform value in the slot tab. I don't think, I have a problem with the first part ( a rotation around the x axis by 10 degree should result in 0.99619,0.08716,0,0 when converted to quaternions) but I am completely at a loss what do with the transform line. Currently it looks like this 1,0,0,0,0,1,0,0,0,0,1,0,0.19755,-0.175,0.11648,1 reflecting the position of my slot.
Thanks in advance, Anska
|
|
|
Post by necrodog on Jan 5, 2017 14:18:28 GMT -5
Hello anska you can transform quaternions into a matrix with blender. Just in the script console put
import mathutils import math
a = mathutils.Quaternion((x,y,z,w)) (xyzw, are the values of your quaternion) b=a.to_matrix()
b.copy()
This is the resulting matrix that blender gets
Matrix(((1.0, 0.0, 0.0), (0.0, 0.98480623960495, -0.17365583777427673), (0.0, 0.17365583777427673, 0.98480623960495)))
You need to put the values in the inverse way they show the vectors. Leave a 0 after putting each vector values It will end like
0,0,1,0,-0.17365583777427673,0.98480623960495,0,0,0.98480623960495,0.17365583777427673,0,0,0.19755,-0.175,0.11648,1
The last four numbers 0.19755,-0.175,0.11648,1 leave them as it is, they are the numbers from the position of your object, the changed values are the values of the rotation matrix.
|
|
|
Post by necrodog on Jan 5, 2017 14:29:04 GMT -5
|
|
|
Post by inabadromance on Jan 5, 2017 16:07:49 GMT -5
I've been hoping and waiting for someone to ask this!.. May i hop into the question too? My item is a cordless phone that i'd like to add a slot for placing the individual phone. I tried the script.. is this okay? how do i know which of the numbers between the commas belong too? Is the script also for the first part (rig orientation)? or is it a different code? This is what i have so far.
|
|
|
Post by anska on Jan 5, 2017 16:56:29 GMT -5
necrodog you are awesome! Thank you for explaining in such great detail, I'll give it a try instantly. inabadromance, for the rig orientation you simply need the quaternions as far as I know.
|
|
|
Post by inabadromance on Jan 5, 2017 16:59:56 GMT -5
anska, yeah i was testing that! when i noticed that the info i'm pasting on the transform box isn't sticking in. It gets marked red as if it was wrong (it probably is) and doesn't get saved. :/ This is the info i have: Matrix(((-0.9760720729827881, 0.2246440052986145, -0.0), (-0.2246440052986145, -0.9760720729827881, 0.0), (0.0, 0.0, 1.0))) ORIGINAL:1,0,0,0,0,1,0,0,0,0,1,0,-0.03651,0.11073,-0.01416,1 (EA) 1,0,0,0,0,0,0,0,0.9760720729827881,0,0.2246440052986145,0,0,0,-0.2246440052986145,0,0.9760720729827881,0
|
|
|
Post by anska on Jan 5, 2017 17:20:58 GMT -5
0,0.2246440052986145,-0.9760720729827881,0,0,-0.9760720729827881,-0.2246440052986145,0,1,0,0,0,-0.03651,0.11073,-0.01416,1 is what you want - at least the way I understand it. You mustened change the last 4 numbers as they define the position of your slot x,z,y,1
Or to make it better to read Matrix(((a, b, c), (d, e, f), (g, h, i)))
your slot position (x,z,y) converts to:
c,b,a,0,f,e,d,0,i,h,g,0,x,z,y,1
|
|
|
Post by Mathcope on Jan 5, 2017 17:29:57 GMT -5
anska Did you use Blender to convert from grades to quaternions or something else?
|
|
|
Post by inabadromance on Jan 5, 2017 17:36:27 GMT -5
anska thank you so much! it was giving me error and i was missing one of the 0! So it worked.. But not the way i expected to :P What i did in blender was go to side view, and rotate the slot to grab de codes. Not sure what part of it translated wrong.
|
|
|
Post by anska on Jan 5, 2017 17:52:08 GMT -5
Mathcope I first used an online service, then noticed blender conveniently can show the rotation in quaternions too (as seen in inabadromance's screenshot) and then went on using blender. (Inbetween noticing, that I had previously mixed the order of the numbers up)
|
|
|
Post by necrodog on Jan 5, 2017 20:26:37 GMT -5
Well. To give some lighting. Heres how the rotation works with the blender utility of the xyz euler and quaternion. If we want to rotate and object with the blender tools in the y axis like the image, please use from the referenced grades showed in the image. Now in blender open a test blend file and then in the screen press N to show the transform tools. First check that XYS Euler rotation option is marked. Now put the desired degrees you want based from the bunny image I posted before. In this time we are going to rotate a buny sculpture -135 degrees. Put -135 on the Y value Now change to Quaternion(WXYZ) option and woala! You get the quaternion values Now put the values in the respective order at "orientation" in studio and if you making a deco slot, get the values from the matrix i said to anska before and put in the "transform" part. To check if you make correctly the matrix values ,first see the absolut transform tag from the bone in the rig. They need to be equally.
|
|
|
Post by necrodog on Jan 5, 2017 20:31:46 GMT -5
|
|
|
Post by Mathcope on Jan 5, 2017 20:33:57 GMT -5
necrodog I've been trying to make this work the whole afternoon and yet I can't :/ As an example I looked in the text file you used in the bone for ctm_chair of your corner desk and I found the quaternions which are these "0,-0.923879981040955,0,0.382679998874664", however If I use the method you point out here in this thread the matrix would be this (if I understand it correctly): -0.7071008086204529,0,0.7071120142936707,0,0,-0.9999964237213135,0,0,-0.7071084380149841,0,-0.7071008086204529,0,0.501042127609253,0,0.699999988079071,1 However, in your text file, you point out that the matrix is : -0.70710676908493,0,0.70710676908493,0,0,1,0,0,-0.70710676908493,0,-0.70710676908493,0,0.501042127609253,0,0.699999988079071,1 and they are different. Is it possible that I miss something? Or you forgot to add a step here? Thank you! You've been of tremendous help edit: OOPS seems that you write some more while I was writing this message. I will check if it solves my issues.
|
|
|
Post by necrodog on Jan 5, 2017 20:39:16 GMT -5
Hello Mathcope to avoid conflict, check the absolute transform of the bone you want to rotate after puting the generated quaternion from the info i post recently. They need to be equall in the transform of the deco slot.
|
|
|
Post by necrodog on Jan 5, 2017 20:48:06 GMT -5
Or if they differ, put the values from the absolute transform of the bone into the transform part of the slot. They cant be copied directly, but the absolute transform of the bone is always right.
|
|