Re: SCOPs with more than one output...
| Date : Wed, 2 Jan 2008 16:24:16 +0000 |
| To : XSI(at)Softimage.COM |
| From : "Dan Yargici" <danyargici(at)gmail.com> |
| Subject : Re: SCOPs with more than one output... |
All the point positions I'm referencing are relative to the object's center and were retrieved using PointCollection.PositionArray. It should be theoretically impossible for there to be any confusion about the frame the cache was made. As I mentioned, the oKine object is object's global kinematic state.
Bearing all this in mind, I would have expected what I posted to work. I presumed (perhaps wrongly?) that MapObjectPoseToWorldSpace is a newly implemented method to achieve what Matt mentions in this post on XSIBase (at the very bottom):
http://www.xsibase.com/forum/index.php?board=14;action="">
I may try his way just in case although I imagine there would be a small overhead.
Thanks again,
DAN
1) What is the relative transform space of your object when you are storing the point cache? Is it global or local to the object center?
2) Just in case, you should consider using the GetTransform2() method off your Global KinematicState as follows:gTrans = obj.Kinematics.Global.GetTransform2(atFrame)
This will ensure you are grabbing the transform at the proper frame in the event the SCOP is not updating properly.
3) When you first start using the remapping methods on XSIMath, they can be very confusing as to what they are doing. Make sure you are getting the proper transform space using simple test nulls before you try to blend it into your more complex point formula. The one you are using (MapObjectPoseToWorldSpace) is to convert a local space of a child to global space. The first argument is typically the global transform of the parent, and the second argument is the local transform of the child, and it returns the global transform of the child.
Since I don't know how you are storing your point info, I can't tell you definitively which transform space conversion to use. :-)On Jan 2, 2008 7:50 AM, Dan Yargici < danyargici(at)gmail.com> wrote:Thanks Brad,
I'm having a little trouble figuring out how to apply this in terms of point positions though... Here's what I'm doing now:
oKine is the Global Kinematic state of the object.
// XYZ Position of point(i) at current frame -2
var aX = oCacheA[i*3];
var aY = oCacheA[i*3+1];
var aZ = oCacheA[i*3+2];
// XYZ Position of point(i) at current frame -1
var bX = oCacheB[i*3];
var bY = oCacheB[i*3+1];
var bZ = oCacheB[i*3+2];
// XYZ Position of point(i) at current frame
var cX = oCacheC[i*3];
var cY = oCacheC[i*3+1];
var cZ = oCacheC[i*3+2];
LposV1 = XSIMath.CreateVector3(aX,aY,aZ);
LposV2 = XSIMath.CreateVector3(bX,bY,bZ);
LposV3 = XSIMath.CreateVector3(cX,cY,cZ);
var > var > var >
oNewTransformA.SetTranslation (LposV1);
oNewTransformB.SetTranslation (LposV2);
oNewTransformC.SetTranslation (LposV3);
var oWorldKineA = XSIMath.MapObjectPoseToWorldSpace( oKine.Transform, oNewTransformA );
var oWorldKineB = XSIMath.MapObjectPoseToWorldSpace( oKine.Transform, oNewTransformB );
var oWorldKineC = XSIMath.MapObjectPoseToWorldSpace ( oKine.Transform, oNewTransformC );
var GposV1 = oWorldKineA.Translation;
var GposV2 = oWorldKineB.Translation;
var GposV3 = oWorldKineC.Translation ;
velV1 = XSIMath.CreateVector3();
velV2 = XSIMath.CreateVector3();
accV1 = XSIMath.CreateVector3();
velV1.Sub(GposV2,GposV1);
velV2.Sub(GposV3,GposV2);
accV1.Sub(velV2,velV1);
However I still get the same results (transforms not effecting the calculation, only deformations)...
Cheers,
DANOn Dec 31, 2007 6:36 PM, Bradley Gabe < withanar(at)gmail.com> wrote:Dan-Have a look at the SDK docs on the XSIMath object which has the following methods:MapObjectPoseToWorldSpaceMapWorldPoseToObjectSpaceMapObjectPoseToObjectSpaceThese are all you should ever need for converting SITransforms between any local and global space. I was just starting to get decent at matrix math for transforms when I discovered these. ;-p
On Dec 31, 2007 11:55 AM, Dan Yargici <danyargici(at)gmail.com> wrote:
Hi Kim, I just got it working!
I'm now creating two variables on the scop itself and pumping my position arrays into there (these are hidden from the user via their capabilities). This way I can manually update them only on frame change when the scop is evaluated and without anything having to be found dirty. It works very well!
My next question is which the shortest route to adding the object's transforms into the equation might be?
I am currently looking at AddParentScaling, AddParentTranslation and AddParentRotation in the SDK however I'm unsure as to whether or not this would be the best technique.
Any input would be most welcome indeed!
Cheers,
DAN
On Dec 31, 2007 5:25 PM, kim aldis <xsi(at)kim-aldis.co.uk> wrote:
Send me the code, Dan, I'll take a look for you.
From: owner-xsi(at)Softimage.COM [mailto: owner-xsi(at)Softimage.COM] On Behalf Of Dan Yargici
Sent: 31 December 2007 15:44
Hehe, no worries ;)
OK, so now I gave up entirely on the UserDataBlob and am using a CustomParameterSet... Now I not only have the same issue with the Cache not being updated unless it's PPG is open, I also have the joy of something else not updating too!
Basically, I now have a CustomParameterSet with two string parameters that I use to store the positions of the points at two different frames. Except only the last parameter created gets updated by the scop.
This has all become way too ridiculous for words...
Cheers,
DANOn Dec 31, 2007 2:48 PM, kim aldis <xsi(at)kim-aldis.co.uk> wrote:
Yeah, sorry. I didn't read your mail properly until I'd replied. Doh!
- Follow-Ups:
- Re: SCOPs with more than one output...
- From: "Dan Yargici" <danyargici(at)gmail.com>
- Re: SCOPs with more than one output...
- References:
- Re: SCOPs with more than one output...
- From: "Dan Yargici" <danyargici(at)gmail.com>
- Re: SCOPs with more than one output...
- From: "Bradley Gabe" <withanar(at)gmail.com>
- Re: SCOPs with more than one output...
| DATE: | << | >> | THREAD: | << | >> | INDEX: | Main | Thread |
|---|
- Previous by Date: Re: Scripting question...
- Next by Date: Re: Scripting question...
- Previous by Thread: Re: Scripting question...
- Next by Thread: Re: Scripting question...
- Index(es):
| Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available. |