PDA

View Full Version : Expression with World Coords?

droodawg127
04-17-2006, 08:11 AM
Is there away to make an expression use the world coordinates of an object instead of its local coordinates? Thanks

phillydee
04-17-2006, 10:49 AM
Found this in the Lscript Reference Manual:
---
Methods
param(specifier)
Given a specifier (POSITION, ROTATION, etc.), you can acquire information on an item’s attribute. getPosition(time), getRight(time), getUp(time), getForward(time), getRotation(time), getScaling(time), getPivot(time), getWorldPosition(time)

----

I guess you can store 'getWorldPosition(time)' in a variable, and then call that var when you need the vector data...

Oops. Realized you're using expressions :P I think [your objectname here].WorldPos(time).[x, y z] would work...

04-17-2006, 10:58 AM
Is there away to make an expression use the world coordinates of an object instead of its local coordinates? Thanks

I'm not comfortable using the square-bracket syntax...here's what I'd use for an object called "foo":

POSITION:
foo.wpos(Time).x
foo.wpos(Time).y
foo.wpos(Time).z

ROTATION:
foo.wrot(Time).x
foo.wrot(Time).x
foo.wrot(Time).x

phillydee
04-17-2006, 11:01 AM
heh. Forgot about wpos and wrot...

droodawg127
04-17-2006, 11:11 AM
Thanks for your help. I'm pretty new to expressions. What is the diff between brackets/no brackets? I get confused about the different expressions and where to make them (expression editor, graph editor, modifiers etc. )

04-17-2006, 11:26 AM
Thanks, phillydee. :o

Thanks for your help. I'm pretty new to expressions. What is the diff between brackets/no brackets? I get confused about the different expressions and where to make them (expression editor, graph editor, modifiers etc. )

I'm not 100% sure what the difference is myself, other than syntax. The brackets might work on objects that have spaces in their names, but I'd have to test it to be sure.

For example, an object called "foo withSpace" will not work in this syntax:

foo withSpace.wpos(Time).x

...but it might work with the bracket-style syntax. Again, though -- I'd have to test it to be sure.

-+-

What helps me a lot when writing expressions in the Graph Editor is the Expression Builder (click on the "Builder" button in the Expressions tab of the Graph Editor). I don't use it to actually create my expressions, but it's handy as a "quick-reference" to the options/commands/syntax available when writing expressions.