Saturday, October 30, 2010

Luminescent Backlit Lighted

Create a follower (object that follows) PART 1

These days I'm working on a script for complex robot.
One of its functions will be to follow the owner as you walk along this area.
Script essential if you want to create animal faithful who follow you wherever you go, or other items you want with you when you move. A follower
clearly there follows after a Teleport, or in areas where scripts are not allowed.

To allow an object to follow, just consider three main points:
- The object must be "physical"
- The object must have a sensor that constantly detects the position of the avatar
- Object moves through the function llMovetoTarget (), to the coordinates detected and can be rotated in terms of how we rotate ..

In addition we add a listener to listen via chat commands start and stop.
It 's a good way to begin to study the functions and duties of llMoveToTarget rotation.
Ultimately we create:

-entry was an event where we light sensor and listener
an event-listen listen to the messages that start and stop
-event sensor suppose that repeated every second, reads the position of our avatar and turns it into a destination for llMoveTotarget function () an event-
no_sensor he does "die" if the object we most recognized nn

The structure is quite simple.

OFFSET ROTATION
and things to which we must pay more attention are the 'offset and the rotation of the prim.

-L 'offset is simply a vector that indicates how much the object should be moved with respect to us.
If the object is to follow our position, and our position is " POS, the POS + position of the object to be offset.
The offset may for example be 3 meters to the left of our avatar, and then write a kind of carrier offset \u0026lt;0, 3, 0>.

-rotation has a dual role: to rotate the object ALWAYS more to our left and has to turn his face where we are paying us.
The first question is simple, it will be enough to detect the rotation and we multiply the offset for the rotation (offset: posizione_offset * rotation)
The second issue is more complex. We will use the llRotLookAt ( ), And create our first function of rotation.
In the second part we will see the complete code , here we just do a summary of key functions: read it very carefully, because you can use them in a lot of situations:

llSetStatus ( STATUS_PHYSICS, TRUE); when
TRUE, the state becomes physical.

llSetStatus ( STATUS_PHANTOM, TRUE);
when TRUE, the state becomes a ghost.

llSensorRepeat ("", id, AGENT , 96.0, PI, 1.0);
turn the sensor that will detect "id", that is, us as it will be id = llGetOwner ()

llMoveToTarget (pos, 1);
moving object with a physical state to a position with a time of 1 sec.Maggiore in this case is the time, the most likely to be slow ' object to reach the target set

llRotLookAt (target, force, time);
allows the object to point its X axis (red axis) towards the target.
In our case the target will be in relation to where we look through the function that we will see in the next post.
NB: the function llLookAt () is rather different in that it does not tip the X axis but the axis Z. Without these small

premises, we have to insert the script and comment in the next post.

0 comments:

Post a Comment