![]() I split it up for clarity, not because you have to. … and you can write it all in a single line if you wish. Putting it all together, and assuming the vector to be rotated (“v”) is locally available as, you'd end up with something like this: The array index at the end "“ extracts element zero of the result (i.e: ”x"), you'd change it to or to extract y and z respectively, or remove it altogether if you want the whole vector returned. To rotate by an arbitrary axis, you want to use the function rotaxis(). However, it can only rotate about three predefined axes: the basis vectors “x”, “y”, and “z”, which is not what you want in this case. The function rotate() returns a matrix, and is meant to post-multiply your “v” in order to transform it. 1-transparent-vmd-movie.md Transparent VMD Movies VMD's Movie Maker is a powerful tool, but modifying a plugin can be a hassle, especially when the program is installed site-wide. The function points() returns a string, and is meant for fetching string attributes, not numerical ones – you're clearly looking for a number not a string, so you'd need to use point() instead. Judging by your syntax, I'll assume you're talking about hscript and not VEX. This will get you started toward what you want.Ykcosmo I want to rotate my v around the axis which is the cross product of my N and v, I tried rotate(35, cross(points(“./a,$PT,”N“), points(”./b“,$PT,”v"))), it shut down my houdini at once…. If (Quaternion.Angle(myTransform.rotation, Quaternion.Euler(cache)) < 0.0001f) If (is_this_TestScript_first_to_go_this_frame()) Pseudocode, underscore_case stuff is VERY pseudo: Transform myTransform If the rotations are determined to be different, assign the uncontrolled components of the transform's eulerAngles to cache and then continue with the usual operation. Quaternion.Angle(a,b) < 0.00001f so that it treats 540,0,0 the same as 180,0,0) the transform's current rotation with the quaternion produced by Quaternion.Euler(cache). When the first TestScript variety in a frame executes, compare (using e.g. Since you would want to have this internal state vector not override uncontrolled vector components in the event any outside change occurs, here's what you could do about that: I don't really care what you do with the other axes and if your quaternion messes up the rotation. In terms of your question, a good one btw, I'd say 181, 0, 360. Then have each component assign that cache to the eulerAngles, or optionally, have only the final TestScript make that assignment. Have each TestScript update cache so that the vector component it controls is set to its current interpolation value. This can be done in a manner similar to cache and how to implement is also out of scope for this question. You will also need a way for each script to determine which components of the euler angles are not controlled. I'll call the value of this vector3 cache for the sake of simplicity. ![]() There are other ways this could be done but that is out of scope. This could be stored in a dictionary, for instance, where each Transform could be used as a key. I would store a Vector3 where all 1-3 TestScript varieties can view and edit it, such that no Transform has more than one of these vector3 associated with it. If any of this is not that clear, check these 2 scripts, where I'm actually trying to achieve this. This script is not actually what I'm trying to achieve but a simplified version of my issue.The rotation has to be from one value to another during a specific period of time, rather than rotate a certain amount over an unspecified amount of time.I'm actually trying to do this for the other 2 axes too.I know that this is due to the fact that quaternions represent a rotation, and there are multiple ways to represent a rotation when converting into euler angles, but that doesn't help me, because I do only want to do one axis rotation and the others not to be modified.I only want to rotate one axis at a time. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |