Jump to content

Angle difference between 2 matrices


Sandidolsak
Go to solution Solved by srek,

Recommended Posts

I don't get any video, so - what are you exactly trying to do?

 

An angle in space is defined between two vectors, so you could get that angle between e.g. the x axes of the matrices. No idea whether you can use that. Or you calculate the transformation matrix between the two matrices, and take the HPB rotation of that transformation. Or you find the rotational axis (if there is one) that allows the matrices to be rotated into each other (I'm actually not sure whether that is mathematically always possible right now). Or you use quaternions.

etc pp

 

Link to comment

Hm the link works fine here, this is the file from the description

dropbox.com/s/irhnbnqt737cjm2/speed%20to%20weight%20v2.c4d?dl=1

He made a python effector that changes weight on velocity, I am trying to convert it to angle based instead (faster rotation = more weight)

Tried converting matrixes to hpb then using VectorAngle to get the difference, then via quaternions, but couldn't get the result.

Link to comment

Check the python effector at line 35:
 

speed = (mx[i].off-p_mx[i].off).GetLength()


Here he calculates the weight, mx is current matrix, p_mx is matrix on previous frame, he calculates the difference in position.
I would like to change this to get the difference in the angle between this 2 matrices.

Here I made an example with 1 clone it simply rotates, it should be white at the start, then red when it spins, and white again when it stops. The code is still original.

rotation to weight v1.c4d

Link to comment
  • Solution

I adjusted the ranges so the angle differences become more pronounced. I also changed the animation values to emphasize what happens. Check especially between frame 49 and 68, where the rotation happens around the axis used to determine the angle resulting in no detected change. If you want to detect every change you need to set this up for all axis and combine the results.

rot_diff_0003.c4d

Here is another version that uses all three axis

rot_diff_0004.c4d

And for good measure, a version that uses all three to create RGB directly. Dark gray, no rotation, white, rotation around all axis.

rot_diff_0005.c4d

Link to comment
×
×
  • Create New...

Copyright Core 4D © 2023 Powered by Invision Community