(Newbie) Umm.. Non-fixed x,y,z values...?
|
|
Jolan Nolan
wannabe
Join date: 12 Feb 2006
Posts: 243
|
06-28-2006 08:00
I don't know what to call it but Let's say the object collects it's current position and then moves to it, plus a value. So like llSitTarget (<variable_x, variable_y, z>  instead of a defined x, y, z. Can it be done like this? Like when you use the teleport hack and it sends you to a specified place. But how about if it targets an object that moves and sends you to its last known position? Sorry if it's not all clear, I have never dealt with this part before but I want to learn. - Jolan
|
|
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
|
06-28-2006 08:21
From: Jolan Nolan I don't know what to call it but Let's say the object collects it's current position and then moves to it, plus a value. So like llSitTarget (<variable_x, variable_y, z>  instead of a defined x, y, z. Can it be done like this? Yes. You can build a vector from a few separate variables rather than constant values... you can access components of a vector individually. check out wiki for details at http://secondlife.com/badgeo/wakka.php?wakka=vectoryou can either add variables to vector parts: vector position = llGetPos(); float height_offset = 5.0; vector new_position = <position.x, position.y, position.z + height_offset>; or you can put together your offset variables into another vector, and add it to current one: vector position = llGetPos(); float height_offset = 5.0; vector new_position = position + <0.0, 0.0, height_offset>; (the latter can be much simplified, but that's just example to show the idea behind it)
|
|
Paul Churchill
Pie are squared
Join date: 8 Sep 2005
Posts: 53
|
06-28-2006 08:27
The individual components of a vector can be accessed with a dot notation. e.g. myVector.x So, does this help ? vector here = llGetPos();
llSitTarget(<here.x+offsetX, here.y+offsetY, here.z>, ZERO_ROTATION);
Paul
_____________________
If there are two ways to interpret something I've said and one of them offends or upsets you, I meant the other one.
|
|
Jolan Nolan
wannabe
Join date: 12 Feb 2006
Posts: 243
|
06-29-2006 07:21
Oh anything would help right now  . What is this 'dot notation'? is it just another way of naming a variable or does the symbol after the dot mean anything? *EDIT* I just checked out that link and I have a couple questions to clarify: A 'vector' IS <#,#,#> meaning within that word lies the parenthese, the commas and the values? And if X,Y,Z were page1,page2,page3 then n00b.y would affect page2? "llGetPos();" only returns vectors? Could a vector also be called a Vertice? In one of the examples it says typing "++foo.z;" will add 1 to the z coordinate(only coords?) of foo. What does '++' have to do with only adding 1 and not any other amount? Hmm.. That above line you gave me is starting to make sense... - Jolan
|
|
Paul Churchill
Pie are squared
Join date: 8 Sep 2005
Posts: 53
|
06-29-2006 07:53
paraphrasing from a couple of entries in the wiki, the dot operator '.' is used as an access operator for members of structures. There are currently only 2 structures supported in LSL - rotations, and vectors. the structure members available are :- rotations : x,y,z,s vectors : x,y,zsticking with vectors as an example, consider the following code:- vector V = < 10, 20, 30 >;
using the dot operator we can extract each of the vector components from the vector structure e.g. V.x will return 10 in this case. This notation is common to other applications, for example POVRay and Mathematica use the dot in a similar way with regard to vectors. Hope this helps. Paul.
_____________________
If there are two ways to interpret something I've said and one of them offends or upsets you, I meant the other one.
|
|
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
|
06-29-2006 07:55
++ is a C language type operator that increments the variable it is attached to by 1. If the variable is also simultaneously used in some operation, placing it in front of the variable will increment that variable before it is used, placing it after the variable means it is not incrremented till the operation is finished.
-- decrements in the same way
They donot really apply to floats that make up vectors in lsl afaik.
|
|
Jolan Nolan
wannabe
Join date: 12 Feb 2006
Posts: 243
|
06-29-2006 07:57
Interesting... is this also used in Javascript? I see that .x everywhere.
- Jolan
|