Mailing List
Home
Forum Home
Softimage
Carrara
trueSpace
Dir3d-l
Maya - a powerful 3D animation and visual effects software
Macromedia Flash Development
Subjects
Cameras
scaleDown command
black out solved
Aircraft Tutorial
Mathematical XYZ ?
Its done This vs That
Its done first week
recommendations for screen video captures?
3DExplorer "Oddity "
New Director
ProTeam renewals
Fuel 's new websites (X post)
Blue peter create a make toy
targeting groups question
XPost: Shockwave 3D game ( sort of )
RES: RES: RES: Fish Modeling
Emitting particles from object intersection
Fuel 's new websites (X post)
Texturing
Big Break Contest Videos
New Plugins
Models and Texture on my updated site
Error Installing Patch tS6 6
Plasma?
Looking for Inspiration
Weird EMail Q
It 's done first week ?
Cherry not cranberry
New game
Camera Animation Problem
Particle plugins?
 
Create2DSkeleton/AppendBone root problem...

Create2DSkeleton/AppendBone root problem...

2005-06-15       - By Nicolas Langlois-Demers

 Back
Reply:     1     2     3     4     5     6     7  

I second that! It will be useful here too! :)

Thanks Brad!

niko


 -- -- Original Message -- --
 From: Morten Bartholdy
 To: XSI@(protected)
 Sent: Wednesday, June 15, 2005 7:54 AM
 Subject: Re: Create2DSkeleton/AppendBone root problem...


 That's a gem Brad :)

 -

 Morten Bartholdy
 3D & VFX Artist




   -- -- Original Message -- --
   From: Bradley R. Gabe
   To: XSI@(protected) ; XSI@(protected)
   Sent: Wednesday, June 15, 2005 2:44 AM
   Subject: Re: Create2DSkeleton/AppendBone root problem...


   Select any number of scene objects, then run the following jscript. It will
build a 2D chain with each bone pointing from one object to the next, in the
order they were selected. The chain root and first bone match orientation. This
is all object model, so it should be pretty fast, even for large selections:

   // BEGIN SCRIPT -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
-- -----
   // Create SIVector3 objects to store position vectors
   var rootPos = XSIMath.CreateVector3();
   var effPos = XSIMath.CreateVector3();

   // Define Chain normal plane
   var normalArr = [0,1,0];

   // Get the global transforms from your first 2 selected objects
   var rootTrans = selection(0).kinematics.global.transform;
   var effTrans = selection(1).kinematics.global.transform;

   // Pull the position vectors from the transform objects
   rootTrans.GetTranslation(rootPos);
   effTrans.GetTranslation(effPos);

   // Create your chain root
   var root = ActiveSceneRoot.Add3DChain(rootPos, effPos, normalArr,
"ChainRoot");
   var bone0 = root.bones(0);

   // Finish off the rest of the chain from the rest of the selection
   for(var i=2; i<selection.count; i++){

           // Grab the global trans off the current item
           effTrans = selection(i).kinematics.global.transform;
           
           // Pull the position vector from the global transform;
           effTrans.GetTranslation(effPos);
           
           root.AddBone(effPos);
   }

   // Get the global transform off the first bone
   var boneTrans = bone0.kinematics.global.transform;

   // Assign the root and the first bone to the first bone's global trans
   root.kinematics.global.transform = boneTrans;
   bone0.kinematics.global.transform = boneTrans;
   // END SCRIPT -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---
-- ---



     Okay, I have a solution for you. But first a quick question: How are you
getting your chain element coordinates, is it from existing elements in the
scene?

     One thing to keep in mind is the chain creation commands and methods rely
on global coordinates. So pulling them off existing nodes requires less code
than having to convert your own coordinates from local to global for everything
.


       I'm not sure if there's a better way to do this trhough the object
model, but I am trying to build chains by specifying an array of (x,y,z
position coordinates) and a position for an up vector.

       My procedure involves creating the first bone in the chain using

       1- Create2DSkeleton command to generate the first bone
       2- zero out the root to match a null correctly oriented.
       3- zero out the first joint.
       3- AppendBone to add additional bones.

       Unfortunately, every time I use an AppendBone command, it seem to re
-orient the root and throws off the rotation bone values.

       If anyone has a better procedure for handling chain ganeration, with
zeroing bones ???


       THX
       RSM

       __ ____ ____ ____ ____ ____ ____ ____ ____ ____ _____
       Raffaele Scaduto-Mendola - www.turbolinea.com
                                  raffaele@(protected)
       ---
       Unsubscribe? Mail Majordomo@(protected) with the following text in
body:
       unsubscribe xsi

     ---
     Unsubscribe? Mail Majordomo@(protected) with the following text in body:
     unsubscribe xsi

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859 (See http://iso-8859.ora-code.com)-1">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>I second that! It will be useful here too!
:)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Thanks Brad!</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>niko</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT:
#000000 2px solid; MARGIN-RIGHT: 0px">
 <DIV style="FONT: 10pt arial">-- -- Original Message -- -- </DIV>
 <DIV
 style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
 <A title=xsi@(protected) href="mailto:xsi@(protected)">Morten
 Bartholdy</A> </DIV>
 <DIV style="FONT: 10pt arial"><B>To:</B> <A title=XSI@(protected)
 href="mailto:XSI@(protected)">XSI@(protected)</A> </DIV>
 <DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, June 15, 2005 7:54
 AM</DIV>
 <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: Create2DSkeleton/AppendBone
 root problem...</DIV>
 <DIV><BR></DIV>
 <DIV><FONT face=Arial size=2>That's a gem Brad :)</FONT></DIV>
 <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
 <DIV><FONT face=Arial size=2>-</FONT></DIV>
 <DIV>&nbsp;</DIV>
 <DIV><FONT face=Arial size=2>Morten Bartholdy<BR>3D &amp; VFX
 Artist<BR><BR></FONT></DIV>
 <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
 <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
 <BLOCKQUOTE dir=ltr
 style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT:
#000000 2px solid; MARGIN-RIGHT: 0px">
   <DIV style="FONT: 10pt arial">-- -- Original Message -- -- </DIV>
   <DIV
   style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:<
/B>
   <A title=brad@(protected) href="mailto:brad@(protected)">Bradley R. Gabe</A
>
   </DIV>
   <DIV style="FONT: 10pt arial"><B>To:</B> <A title=XSI@(protected)
   href="mailto:XSI@(protected)">XSI@(protected)</A> ; <A
   title=XSI@(protected)
   href="mailto:XSI@(protected)">XSI@(protected)</A> </DIV>
   <DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, June 15, 2005 2:44
   AM</DIV>
   <DIV style="FONT: 10pt arial"><B>Subject:</B> Re:
   Create2DSkeleton/AppendBone root problem...</DIV>
   <DIV><BR></DIV>Select any number of scene objects, then run the following
   jscript. It will build a 2D chain with each bone pointing from one object
to
   the next, in the order they were selected. The chain root and first bone
   match orientation. This is all object model, so it should be pretty fast,
   even for large selections:<BR><BR><FONT face="Courier New, Courier"
   color=#008000>// BEGIN SCRIPT
   -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----<BR>//
   Create SIVector3 objects to store position vectors<BR></FONT><FONT
   face="Courier New, Courier">var rootPos = XSIMath.CreateVector3();<BR>var
   effPos = XSIMath.CreateVector3();<BR><BR></FONT><FONT
   face="Courier New, Courier" color=#008000>// Define Chain normal
   plane<BR></FONT><FONT face="Courier New, Courier">var normalArr =
   [0,1,0];<BR><BR></FONT><FONT face="Courier New, Courier" color=#008000>//
   Get the global transforms from your first 2 selected objects<BR></FONT>
<FONT
   face="Courier New, Courier">var rootTrans =
   selection(0).kinematics.global.transform;<BR>var effTrans =
   selection(1).kinematics.global.transform;<BR><BR></FONT><FONT
   face="Courier New, Courier" color=#008000>// Pull the position vectors from
   the transform objects<BR></FONT><FONT
   face="Courier New, Courier">rootTrans.GetTranslation(rootPos);<BR>effTrans
.GetTranslation(effPos);<BR><BR></FONT><FONT
   face="Courier New, Courier" color=#008000>// Create your chain
   root<BR></FONT><FONT face="Courier New, Courier">var root =
   ActiveSceneRoot.Add3DChain(rootPos, effPos, normalArr, "ChainRoot");<BR>var
   bone0 = root.bones(0);<BR><BR></FONT><FONT face="Courier New, Courier"
   color=#008000>// Finish off the rest of the chain from the rest of the
   selection<BR></FONT><FONT face="Courier New, Courier">for(var i=2;
   i&lt;selection.count;
   i++){<BR><BR><X-TAB>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</X-TAB
>//
   Grab the global trans off the current
   item<BR><X-TAB>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</X-TAB
>effTrans
   =
   selection(i).kinematics.global.transform;<BR><X-TAB>&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;</X-TAB><BR><X-TAB>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;</X-TAB>//
   Pull the position vector from the global
   transform;<BR><X-TAB>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</X
-TAB>effTrans.GetTranslation(effPos);<BR><X-TAB>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;</X-TAB><BR><X-TAB>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;</X-TAB>root.AddBone(effPos);<BR>}<BR><BR></FONT><FONT
   face="Courier New, Courier" color=#008000>// Get the global transform off
   the first bone<BR></FONT><FONT face="Courier New, Courier">var boneTrans =
   bone0.kinematics.global.transform; <BR><BR></FONT><FONT
   face="Courier New, Courier" color=#008000>// Assign the root and the first
   bone to the first bone's global trans<BR></FONT><FONT
   face="Courier New, Courier">root.kinematics.global.transform =
   boneTrans;<BR>bone0.kinematics.global.transform = boneTrans;<BR></FONT>
<FONT
   face="Courier New, Courier" color=#008000>// END SCRIPT
   -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----<BR><BR>
<BR></FONT>
   <BLOCKQUOTE class=cite cite="" type="cite">Okay, I have a solution for
     you. But first a quick question: How are you getting your chain element
     coordinates, is it from existing elements in the scene?<BR><BR>One thing
     to keep in mind is the chain creation commands and methods rely on global
     coordinates. So pulling them off existing nodes requires less code than
     having to convert your own coordinates from local to global for
     everything.<BR><BR>
     <BLOCKQUOTE class=cite cite="" type="cite">I'm not sure if there's a
       better way to do this trhough the object model, but I am trying to
build
       chains by specifying an array of (x,y,z position coordinates) and a
       position for an up vector.<BR><BR>My procedure involves creating the
       first bone in the chain using<BR><BR>1- Create2DSkeleton command to
       generate the first bone<BR>2- zero out the root to match a null
       correctly oriented.<BR>3- zero out the first joint.<BR>3- AppendBone to
       add additional bones.<BR><BR>Unfortunately, every time I use an
       AppendBone command, it seem to re-orient the root and throws off the
       rotation bone values.<BR><BR>If anyone has a better procedure for
       handling chain ganeration, with zeroing bones
       ???<BR><BR><BR>THX<BR>RSM<BR><BR>__ ____ ____ ____ ____ ____ ____ _____
__ ____ ____ __<BR>Raffaele
       Scaduto-Mendola - <A href="http://www.turbolinea.com/"
       eudora="autourl">www.turbolinea.com</A><BR>&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       raffaele@(protected)<BR>---<BR>Unsubscribe? Mail
       Majordomo@(protected) with the following text in body:<BR>unsubscribe
       xsi</BLOCKQUOTE><BR>---<BR>Unsubscribe? Mail Majordomo@(protected)
with
     the following text in body:<BR>unsubscribe
xsi<BR></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>