|
From: Braden M. <br...@en...> - 2010-03-03 18:13:32
|
On Mon, 2010-03-01 at 04:40 -0800, cheribhai wrote:
>
> Hello,
> A quick question on vector asssignment using openvrml. I have a
> javascript function where I am dynamically changing the key values of a
> position interpolator, but the assignment does not seem to work.
> I have tried
> PosInter.keyValue[1][0] = targetPosition[0]; // x
> PosInter.keyValue[1][0] = targetPosition[1]; // y
^
a typo, presumably. :-)
> PosInter.keyValue[1][2] = targetPosition[2]; // z
First off, you need to be using directOutput TRUE in order to set the
node field like this.
But assuming you've done that, I think this still doesn't work because
you end up setting the elements of a temporary SFVec3f that keyValue[1]
returns. I think there's an argument to be made that this syntax should
work; but I haven't found a good way to do that with SpiderMonkey.
It should work to set the entire SFVec3f element at once:
PosInter.keyValue[1] = targetPosition;
> and also
>
> PosInter.keyValue = [0 0 0, targetPosition[0] targetPosition[1]
> targetPosition[2]];
>
> but both don't work.
MF* types are not JavaScript arrays; so I wouldn't expect that to work.
--
Braden McDaniel <br...@en...>
|