View Full Version : Set full position in expressions?

04-30-2005, 01:46 PM
Is there a way to set an object's full position to a position vector with expressions?

I'm getting tired of doing:

Foo.PositionX: <lots of math to get a vec>.x
Foo.PositionY: <lots of math to get a vec>.y
Foo.PositionZ: <lots of math to get a vec>.z

and having to change all 3 locations every time I want to change the math.

I really just want some place to say

Foo.Position: <lots of math to get a vec>

It's especially aggravating when I have multi-line expressions: e.g.

Foo.PositionX: D
A: <some math>
B: <some math involving A>
C: <some math involving B>
D: <some math involving C>.x

Foo.PositionY: D
D: <....>.y



04-30-2005, 07:21 PM
What exactly do you want do do, because I'm not following. Are you trying to get the world position of the object? If you told me what you were going to use the results for I may understand a bit better.

04-30-2005, 08:50 PM
I was going to set the object space position of an object, following some math to determine the desired position.

e.g. I want to do something like:

Foo.Position = normalize(cross3d(Object2.wpos(Time)-Object1.wpos(Time),Object1.forward(Time)))

or whatever - I just made that up.

But the way expressions work I need to add an expression to each of the three channels: Position[XYZ]:

Foo.PositionX: normalize(cross3d(Object2.wpos(Time)-Object1.wpos(Time),Object1.forward(Time))).x
Foo.PositionY: normalize(cross3d(Object2.wpos(Time)-Object1.wpos(Time),Object1.forward(Time))).y
Foo.PositionZ: normalize(cross3d(Object2.wpos(Time)-Object1.wpos(Time),Object1.forward(Time))).z

which seems silly.

The question is kind of moot now though - I think expressions are not quite as powerful as I thought they'd be - I'll just use an Lscript. I didn't know that expressions were limited to only 4 lines, and I didn't know that A, B, C, and D in the channel expression panel were typed as doubles, and that I could not store vectors in there. e.g. you can do

Foo.PositionX = A

but you can't do

Foo.PositionX = A.x

which makes it kind of useless for doing even really basic vector math.

04-30-2005, 09:04 PM
Yep, well expressions only work with one channel. You can get information from other channels but they only output the colour/position for a single channel.

It sounds like what you want to do woiuld be more suited to a motion lscript.