I need scripting help for rotation by texture
#1
I want to control particle rotation from an animated map, I pretty much have no idea when it comes to scripting. I did create a system many years ago in pflow with box 3, but can't find the file anymore so can't even reference how I did it back then.


I have started with the scripted scale example and tried to hack it from that, replacing the scale section with this.

Quat inrot = tf.GetRot(sInx);

//I assume this sets a variable called inrot for the initial rotation



Quat rot = new Quat(.01f + color * 10 ,0 ,0 ,0);

// I assume the 4 values in brackets represent x,y,z,w however I am not sure what to set the values at to make the x value rotate 180 degrees based on the white value in the map, Currently using what was in the example file has I get some movement, but it does not appear limited to the x-axis.
I have no idea why the .01f value is used and what value the color variable will be, is it for example if the map is 50% grey a value of 127 or is it 0.5?



tf.SetRot(sInx, inrot + rot);


//I assume that this will just add the map based rotation to the original rotation of the particle.

Basically, I want to flip the particles 180 degrees on their x-axis based on white values.

Any help would be appreciated, thanks. ( I do miss the data operator, although I do understand scripting is more powerful and faster. Just need to wrap my head around it now)
  Reply
#2
quat ,max rotation is 1.0f,maybe 0.01f+color*10>1.0f,so it not work?
0.01f+color/255,0,0,0?
you can print the value to see the whete is the error
  Reply


Forum Jump: