Anim8or Community

General Category => Ongoing Anim8or Development => Topic started by: Steve on October 20, 2015, 11:46:22 pm

Title: Trackball Rotation in the Sequence Editor
Post by: Steve on October 20, 2015, 11:46:22 pm
I just posted build 1194 (http://www.anim8or.com/download/preview/files/animcl1194.zip) that uses trackball controls for rotating bones. There are several issues that have cropped up in the interaction between using a trackball and joint limits.

First some background:

Most people think of rotations as independently applied in the X, Y and Z axes, known as Euler angles. However this is not the case when using a trackball.

Anim8or's first rotates a bone in the X-axis (pitch), then the Z-axis (roll) relative to the bone's local coordinate system after the X rotation.  Finally the Y-axis (yaw) is applied.  Since the X rotation is made first, the "X-axis" is not changed by subsequent Z and Y rotations. In fact it is possible to align two axes, resulting in the well-known state of "Gimbal Lock". If you enable "Show Axis" (hot key X) in the sequence editor you can see this happening. For this, and other reasons, Anim8or uses quaternions, which do not have this problem, to interpolate rotation.

When displaying rotations Anim8or converts the quaternion into separate X, Y and Z rotations. This is ambiguous at best for several reasons. First there are 6 different orders in which the rotations can be applied. Second even for a given order, there can be multiple individual rotations that produce the same orientation.

The problems:

1) How should the trackball be oriented? The 3 axes of a trackball are always at right angles while the three axes of the Euler representation are not. I have chosen to use the final orientation, that is after the rotations have been applied. Thus the Y axis of the trackball will always be aligned with the Euler Y axis (since it is the final rotation applied as view by Euler). But the X and X axes will not always be aligned with the Euler X and Z axes.

So rotating a trackball around the X or Z axis will generally change the values of multiple Euler angles.

I don't believe that this will be a problem if you simply work on the screen and ignore the numeric values for X, Y and Z.  They aren't that useful anyway.  Let me know what you think after you've used the trackball for a while.

2) Joint limits: If you are using joint limits, or have one or more axes locked, you might see some strange behavior.  I have been able to limit the weirdness when only one axis is free and will be improving it further in the near future, but I don't know exactly what to do for 2 and 3 free axes.

Maybe joint limits aren't such a good idea...


Title: Re: Trackball Rotation in the Sequence Editor
Post by: cooldude234 on October 21, 2015, 10:04:25 am
rotation with the track ball is great. There's only two things I wish were added/fixed.
1 being that when I zoom out the track ball doesn't really match the size of the bone relevant to the screen size (basically the minimum size of the track ball needs to be smaller).
2 I cannot rotate on the z axis that is always relevant to the camera's direction (the circle that always is on the outside of the track ball should allow me to rotate the bone that direction).
Other than that it's pretty darn awesome!

(PS. joint limits are really useful for a rudimentary self collision system. Ie like when a leg comes in to contact with it's self. Although I've used them more in other applications than anim8or, I still think they have significant value here. (also I plan on adding them to my engine, reading the values from a .an8 bone properties) just thought I'd let you know).
Title: Re: Trackball Rotation in the Sequence Editor
Post by: Water Music on October 22, 2015, 07:16:06 pm
I use joint limits so I can make sure that the bones move in the correct direction.  I don't mind getting rid of them so long as there is an easy way to select which route a bone takes to get from keyframe 1 to keyframe 2.  Could be a tie-in to have a window for more advanced speed controls (graphing the acceleration/deceleration between keys, etc.).  The trick, of course, is getting all of that in an unobtrusive top-level interface.
Title: Re: Trackball Rotation in the Sequence Editor
Post by: johnar on November 05, 2015, 04:37:49 am
loving the trackball, the interface changes, and the color scheme. (http://s16.postimg.org/ixwuw3a35/Thumbs_Up_W1.gif)
 All working fine so far. Massively impressed. Falling in love with the new Anim8or, all over again.
 Awesome Steve. (http://s8.postimg.org/j64xwcx9d/Big_Grin_Gry.gif)
Title: Re: Trackball Rotation in the Sequence Editor
Post by: johnar on November 23, 2015, 06:31:47 am
 A note, rather than just a 'wow this is cool' post. (http://s13.postimg.org/668ay1knn/blush1gry.gif)
  I'm seeing now the wierdness that can occur with joint limits.
  I've got a forearm bone, with joint limits set at -90 and 90 on all 3 axis. (not anatomically correct i know)
 I move the bone along the x axis, with left MB, and when it reaches 90 degrees it starts to rotate on the y axis.
 I realise this is still on the 'to do' list, and just wanted to put in my 2 cents.
 I also do use bone limits, and feel that to do away with them would be unfortunate.
 Good luck with this one steve, and, oh yeah, 
Quote
wow this is cool
. (http://s8.postimg.org/j64xwcx9d/Big_Grin_Gry.gif)
Title: Re: Trackball Rotation in the Sequence Editor
Post by: slex on March 15, 2016, 12:09:50 am
Is it possible to hide those 3 (red,blue and green) rings that appear while rotating bones, so it would be possible to use fast selection without accidentally making unwanted movements of some bones?
Can some bones be locked on their positions in space (x,y,z)?- so if we move the whole skeleton few millimeters those bones and its attached parts of the body remain in their locked position in the world while the rest of the body stretches=morphs.

thanks in advance.
Title: Re: Trackball Rotation in the Sequence Editor
Post by: kreator on March 15, 2016, 06:33:29 am
Slex: In Figure Mode Goto Edit/Toggle Trackball Visibility.You will need to toggle each bone, its not a global thing. :-*   I find Fast selection to be a Pain in the neck so I always have it disabled!


 For static Bones that I do not want to move I just disable the the relevant axis and lock them.
Title: Re: Trackball Rotation in the Sequence Editor
Post by: slex on March 15, 2016, 03:02:06 pm
kreator: Thank you very much, hiding the trackball works great- I didn't know that option.
   
Locking the bones only locks the selected bone towards the parent bone, I was wondering is there any way to lock some bone towards the workspace?
 
Title: Re: Trackball Rotation in the Sequence Editor
Post by: slex on March 17, 2016, 04:12:41 pm
I hope this is the right topic to post this question.
 Can anybody tell me how to link two bones together, so when I rotate one bone so does the other automatically? I need that for the eyes of the object.
Title: Re: Trackball Rotation in the Sequence Editor
Post by: Raxx on March 17, 2016, 06:09:50 pm
Not really the place to ask. How-to questions belong in the General Anim8or Forum unless it's specific to a new feature in the development release.

However, to answer your question, there's no way to currently do so. Anim8or is too simplistic in its circular dependency restrictions, thus preventing one bone from copying the rotations of another bone in the same figure.

Manually keying the two eye bones is the easiest way, asides from the morph targets approach of creating the eye movement of both eyes as morph targets and animating them that way. A potentially harder way is to have the eyeballs as separate objects in the scene and set them to "face target" a target so that they automatically rotate and follow a target...but then you have to try and keep the eyeballs in the head while you're animating the body.

Maybe other users have found easier solutions.
Title: Re: Trackball Rotation in the Sequence Editor
Post by: slex on March 17, 2016, 06:43:03 pm
Thanks. I forgot to try search button first ???
Title: Re: Trackball Rotation in the Sequence Editor
Post by: Steve on March 17, 2016, 08:41:35 pm
slex: "... Can anybody tell me how to link two bones together ..."

You can do this with controller scripts where you set the angle of a bone to another animatable property such as a user defined attribute or another element.  Here's an example where I use the orientation of a target to controller the orientation of two eyes.

You can also use another elements bone angles, etc.  Note: you can't currently use an angle form the same figure since Anim8or thinks that is a circular dependency.  I'll refine the dependency testing to allow you to refer to other values in the same figure.
Title: Re: Trackball Rotation in the Sequence Editor
Post by: thecolclough on March 18, 2016, 03:23:31 pm
Can anybody tell me how to link two bones together, so when I rotate one bone so does the other automatically? I need that for the eyes of the object.
for eyeballs, my advice on how to do this would be: don't!  three-quarters of character animation lives or dies on the eye movement, and one of the easiest ways to get it wrong is to always have the two eyes pointing exactly the same direction.  their directions should converge or diverge depending on how close the character is to the thing they're looking at, and that can change dramatically within a fraction of a second (say for example Character A is talking to Character B, who's right next to them, but then their attention is caught by something in the distance behind B), which means you would usually have to animate each eye separately anyway.  even when you're looking at something pretty far away, the eyes' directions still won't be absolutely parallel; the difference might go down to a degree or two, but never (or at least nearly never) zero.
Title: Re: Trackball Rotation in the Sequence Editor
Post by: Steve on March 18, 2016, 06:46:05 pm
Agreed, I posted this as a solution to his question and to problem in general. For eyes, for example, you can use another property for the convergence, or a target as the focal point, etc. Scripts are a very powerful way of specifying behavior.
Title: Re: Trackball Rotation in the Sequence Editor
Post by: slex on March 18, 2016, 07:29:50 pm
Thanks mr.Steve for the figure, it's very interesting to explore the script. It was quite a shock when I saw those bones linked to a target because that was the next question that I thought to ask relating to 'eye rotating' issue. I don't want to be rude but scene mode in Anim8or would be greatly improved if that script could be implemented and used on gui in some next development built, so the bone/s could be controlled with the target directly- the same way as the object,camera or light can.
 Meanwhile, I'll try to replicate and modify the script :), it's interesting that the target cannot be manually rotated and changing its position or size doesn't affect the object, it only 'responds' to manual key change ???

 regards
Title: Re: Trackball Rotation in the Sequence Editor
Post by: Raxx on March 19, 2016, 11:40:36 am
I'd forgotten about that kind of linking via ASL.

I know I'm steering the topic shamelessly, but one of the things I was wanting to do when slex asked about it (and one of the examples for why I recently made a post about controller script changes), is to make a "lookAt" script for an arbitrary bone. This is a simple implementation with math of which many examples can be found online, but without the ability to get the position and orientation of a bone, it's nearly impossible to make a lookAt script (or an IK script). Also, things would be simplified if it was just a simple "orientation" parameter rather than separated x/y/z parameters.

Coupled with those changes,

...scene mode in Anim8or would be greatly improved if that script could be implemented and used on gui in some next development built, so the bone/s could be controlled with the target directly- the same way as the object,camera or light can...

If a few enhancements to interfacing between the user and scripts, such as being able to load scene scripts from the scripts directory as script elements (selectable in a scripts menu), and allowing scripts to set parameters the same way parametric shapes are done (in a dialog box via the GUI), with these parameters being keyable, then lookAt, IK, particles, physics, etc can be implemented via scripts in a user-friendly way. Some of these scripts can, if useful enough, be packaged with Anim8or internally and become an integral part of the animation experience.
Title: Re: Trackball Rotation in the Sequence Editor
Post by: Steve on March 19, 2016, 05:41:14 pm
As I've mentioned before after working on modeling I will be addressing animation.  Many of these issues will improve but not necessarily in the ways described here.
Title: Re: Trackball Rotation in the Sequence Editor
Post by: johnar on July 01, 2016, 12:05:08 pm
 Toggling trackball visibility seems a bit confusing as is.
 (visibility is being turned on and off in regards to order of selection,  a shortcut key is needed to toggle visibility in this fashion)
 It is also necessary to have the extra option to turn ALL trackball visibility completely off, and stay off until toggled back on. (imho) (http://s6.postimg.org/p4cqdev8d/grysmile.gif)
 
Title: Re: Trackball Rotation in the Sequence Editor
Post by: Steve on July 02, 2016, 10:36:13 pm
johnar: I agree, the trackball visibility option is clumsy to use.  I'll clean this up.  Currently I think that adding a per-bone disable check box in the bone parameters dialog, plus a global button to override this and disable all trackballs would work.  (Or possibly a 3-state button with (Use Bone Default)/(Disable All)/(Enable All), or would that be too confusing?
Title: Re: Trackball Rotation in the Sequence Editor
Post by: johnar on July 03, 2016, 01:29:03 am
 Hi steve (http://s6.postimg.org/p4cqdev8d/grysmile.gif)
Adding a per-bone disable checkbox in the bone parameters dialog could actually be un-necessary.
 The option of disabling the visibilty of trackball came about because of the mess created when multiple bones are selected.
 Choosing seperately which bones show trackball and which bones don't, may in reality not be an easilly workable option. (when working intertmittently with single then multiple bones, it would be near impossible, in most cases, to know beforehand which trackballs you need to hide.) (if this doesn't make sense, let me know and i'll try explain more clearly).
 My feelings are that a simple Disable All and then Enable All, would be a good place to start. Perhaps an on/off button in the top(?) toolbar, backed up with a shortcut key, may be all that's required....
 
Title: Re: Trackball Rotation in the Sequence Editor
Post by: johnar on July 04, 2016, 06:56:09 am
Quote
Perhaps an on/off button in the top(?) toolbar
Maybe it would fit in the sidebar, next to the 'axis' button?
(http://i63.tinypic.com/11vr5ld.gif)



Title: Re: Trackball Rotation in the Sequence Editor
Post by: Steve on July 04, 2016, 05:06:54 pm
Good idea (and nice glowy colors :) )
Title: Re: Trackball Rotation in the Sequence Editor
Post by: daniel99 on August 06, 2016, 11:40:36 am
Hey, Steve. I've just seen this post, and that script is just amazing and very useful.
But I have a little problem, I hope you can help me:

I have a character, and I've tried to link the tail bones to a target (example: bone09, bone10, bone11). All is well and good, but it only reacts to X coordinates.

When I changed the script like this:
________________________
point3 $angles;

$angles = QuaternionToRPY(GetAttributeQuaternion("tail", "orientation"));
$joint.bone09_X = -$angles.x;
$joint.bone09_Y = -$angles.y;

___________________________

I keep getting this error :

Parse error on line 5

So it seems I can not add the Y coordinates, or I'm not doing it right.

Same problem if I try to change the X to Y coordinate:

$angles = QuaternionToRPY(GetAttributeQuaternion("tail", "orientation"));
$joint.bone09_Y = -$angles.y;


Can u help? Thanks!

Title: Re: Trackball Rotation in the Sequence Editor
Post by: Steve on August 06, 2016, 09:59:24 pm
daniel99: Joint controllers are scalars and each controls only one angle: X, Y or Z.  Your script must be for the X joint angle which is why you can't assign the Y component - there is no predefined variable $joint.bone09_X to assign anything to. So you need to write multiple scripts:

1) Double click on the bone09-X joint in the track window to assign the X component to $joint.bone09_X = -angles.x;
2) Double click on the bone09-Y and then bone09-Z and assign them their respective values.

I've attached simple example that does something similar.
Title: Re: Trackball Rotation in the Sequence Editor
Post by: daniel99 on August 06, 2016, 11:11:34 pm
Thanks, Steve.  Got it! :D
Before you replied, I have just rotated the bones in the figure mode, so the X axis became Y axis. (wich I needed most in my scene)

But I did how you said, and now I have control over X and Y axis.
I had to create a keyframe for bone_Y (it didn't show otherwise), and after I created the script, the keyframe disappeared and now the controller works just fine.
One million thanks for this, man!

Btw, any updated versions for the IK tool?
Title: Re: Trackball Rotation in the Sequence Editor
Post by: Steve on August 07, 2016, 03:21:36 am
I should be posting an IK update in a day or two :)
Title: Re: Trackball Rotation in the Sequence Editor
Post by: daniel99 on August 07, 2016, 01:07:30 pm
Great news. Can't wait to test it :D
Title: Re: Trackball Rotation in the Sequence Editor
Post by: johnar on October 06, 2016, 09:29:21 pm
Hi again steve, and an8 users
Been thinking more about trackball visibility, re difficulty in using overlapping trackballs.
 Just a thought here, but maybe, what if, only the last bone selected shows the trackball. That would end the birdsnest of multiple trackballs showing at once, and if the trackball you need isn't the one showing , when you enter FK from IK, then you just click on the appropriate bone to show the appropriate trackball.
 After all, is there any need to show more than one trackball at a time?
 I'm thinking maybe not??.......