[no subject]

Thanks,
Serguei

-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf
Of Bradley Gabe
Sent: October 19, 2006 2:14 PM
To: XSI(at)Softimage.COM
Subject: RE: Motion along a specified vector

Ah yes, the good old wheel problem.

One way I like to solve this one is to ignore the local axis vector
altogether! Instead, it's very easy to use global space and plot a curve
that represents total distance traveled. Then you can set up an
expression that relates the distance being traveled to the wheel's
circumference.

Here's a function that plots a distance traveled. Just input an
X3DObject:

function BG_PlotDist(obj)
{
	// Find or add "Distance" property
	prop = obj.properties('Distance');
	if(!prop){
		prop = obj.AddProperty('CustomProperty', false,
'Distance');
	}

	// Find or add "sum" parameter
	param = prop.parameters('sum');
	if(!param){
		param = prop.AddParameter3('sum', siFloat, 0, 0, 100000,
true);
	}
	
	// Get scene settings
	Play = Dictionary.GetObject('PlayControl');
	sF = Play.In.value;
	eF = Play.Out.value;
	iter = 1;

	// Store Fcurve data in an array
	valArr = new Array();

	// Calculate global distance traveled
	sum = 0;
	var i=0;
	for(var f = sF; f<=eF; f+= 1/iter){
		
		// Grab current global pos
		pos0 = XSIMath.CreateVector3();
		obj.Kinematics.Global.Transform(f).GetTranslation(pos0);
		
		// Grab global pos from last frame
		pos1 = XSIMath.CreateVector3();
	
obj.Kinematics.Global.Transform(f-1/iter).GetTranslation(pos1);
		
		// Subtract last pos from current pos to get velocity
		pos0.SubInPlace(pos1);

		// Add length of vel to sum
		sum += pos0.Length()
		valArr[i++] = f
		valArr[i++] = sum
	}
	param.AddFcurve2(valArr, 20);
}	



> Thanks for the helps guys!
> I will read up on vector projection and will give it a try.
> 
> And yes I am aware that I will not get the full value. I am working on
a
> wheel and basically I only want to register the movement that takes
> place along the direction (vector) that the wheel is pointing at.
> 
> Thanks,
> Serguei
> 
> -----Original Message-----
> From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On
Behalf
> Of Thomas Helzle
> Sent: October 19, 2006 7:20 AM
> To: XSI(at)Softimage.COM
> Subject: Re: Motion along a specified vector
> 
> Hi Serguei,
> 
> but you are aware that you will not get the "full" value of the
> movement? (that would be the vector length of the change itself)?
> 
> For you case, you will have to project the movements vector onto your
> "value-vector" and then compute the resulting vectors length.
> 
> BTW. Since there were a lot of questions regarding vector math lately,
I
> want to recommend the following book:
> "3D Math Primer for Graphics and Game Development"
> http://www.amazon.com/exec/obidos/ASIN/1556229119/thomahelzlges-21
> (watch the line wrap)
> It does a very good job in explaining vector and matrix math from a
> beginner to intermediate level, with really fun and clear examples and
> methodology.
> 
> A very good online ressource can be found here:
> http://chortle.ccsu.edu/VectorLessons/vectorIndex.html
> 
> Best regards,
> 
> Thomas Helzle
> 
> 
> 
> 
> On Thu, 19 Oct 2006 00:06:07 +0200, Serguei Kalentchouk
> <serguei.kalentchouk(at)ubisoft.com> wrote:
> 
> > Hey all,
> >
> > I am trying to find a way to isolate motion along a specified
vector?
> >
> > What I would like is to transform something in x and y and get a
value
> > of how much it moved along a vector that I specify.
> >
> > Any help would be much appreciated.
> >
> >
> > Cheers!
> >
> >
> > Serguei K.
> >
> > - Ubisoft Cinematics -
> >
> >
> 
> 
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
> body:
> unsubscribe xsi
> 
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
body:
> unsubscribe xsi

---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
body:
unsubscribe xsi

---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.