View Full Version : lscript question - "Align Pitch" in scripting?

03-05-2009, 09:58 AM
I can't seem to get "Align Pitch" working the same way in lscript as I can when mousing around Layout.

My general process is:

load an object with skelegons
convert skelegons to bones
select a bone

record pivot rotation
align pitch

I can script everything correctly (I think) up to aligning the pitch. I can't seem to get this right in scripting.

In lscript,

I grab the mesh's overall rotation
Then, for each bone, I set the rest rotation with RecordPivotRotation().
I then apply the mesh's rotation to each bone, but it doesn't seem to have an effect - the object ends up twisted beyond recognition.

Any help?

03-05-2009, 01:44 PM
Did you rest your bones? It sounds like they are not rested.

It can be done by pressing 'r'.

03-05-2009, 01:45 PM
Also if you have a sample scene I could take a look at it.

03-05-2009, 04:32 PM
Basically, I want to do everything within lscript, and not in Layout.

Actually, the process within Layout works just fine. The problem I am having is converting the Layout process into an lscript.

I cannot share the scene as it's proprietary. But the methods I am using work the same on most any object/scene (I think). I've attached a series of 4 objects at various points of bone alignment:

the Modeler object
the object freshly brought into Layout
the object after the manual process in Layout (described earlier)
the object, mangled by the lscript (described earlier)

03-05-2009, 07:36 PM
Ahhh, a little out of my league. Sorry, I'm not that great with Lscript. :(

I hope someone can help you.

03-05-2009, 08:37 PM
LScript questions should be posted here:

LSCRIPT DISCUSSIONS (http://www.newtek.com/forums/forumdisplay.php?f=30)
LSCRIPT TECH SUPPORT (http://www.newtek.com/forums/forumdisplay.php?f=168)

Problems with scripts/code usually are accompanied by scraps of code so us programmers can look it over.

Anyway, I'll simply shoot in the dark here:
Are you using the Generic_BT_AlignPitch command?

03-06-2009, 11:09 AM
I've encountered strange lscript particulars this way. Sometimes you need to set the keyframe at 0 *after* any rotations, translations, or scale for it to take effect.

03-07-2009, 05:40 PM
Thanks, I will.

How are you setting the keyframe? I have tried moving one frame forward and then back.

(Please respond in the lscript forum. I have posted this thread there.)