Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Pet Follow - llLookAt() troubles

Jordon Bernard
Registered User
Join date: 30 Nov 2007
Posts: 3
05-27-2009 07:54
Hi,

I've tried a couple of different pet follow script, one found here and one at http://lslwiki.net/lslwiki/wakka.php?wakka=PetProtocol032. I do like the second one better and with tweaking of values it works ok.

Yet there is still a problem. Perhaps I do not quite understand the llLookAt() function. The original prim that is to follow turns 90 degrees from vertical to horizontal the moment the script is activated. In fact, it appears that the top of the object points straight at the target. Assuming that is the z axis and it is doing what is intended. But how can I make it point along the y axis? Alternately, the object is a sculpty, how can I switch y axis versus z axis on the sculpty? Because it doesn't matter if I use rotate on the object in edit mode, has no impact at all at how it points with llLookAt() active.

One last thought... would it be possible to 'tilt' the object just slightly when it starts moving, to imply motion, and have it stand still when it is not moving and just waiting to follow?

Thanks,
Jordon

CODE

// follow script
//

startup()
{
llSensorRemove();
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, TRUE);
llSetStatus(STATUS_ROTATE_Z, TRUE);
llSetStatus(STATUS_PHANTOM, TRUE);
llSensorRepeat( "", llGetOwner(), AGENT, 100, PI, 0.5 );
}

default
{
state_entry()
{
startup();
}
on_rez(integer param)
{
startup();
}

link_message(integer sender_num, integer num, string str, key id)
{
if (str == "follow")
llWhisper(0, "follow");

llSensorRepeat( "", id, AGENT, 100, PI, 0.5 );

}

no_sensor()
{
llSetTimerEvent(30); // the ride may be lost, die in 30 seconds
}
timer(){
llWhisper(0, "cannot find target ");
//llDie();
} // haven't detected the user for 30 seconds, so delete the ride
sensor( integer total_number )
{
vector vTarget = llDetectedPos(0);
rotation rTarget = llDetectedRot(0);
vector vOffset = <-2.0,0,-0.2>; // offset from the agent's center

vector vDestination = vTarget + vOffset * rTarget;
// llLookAt(vDestination, 2, 0.2);

llMoveToTarget(vDestination, .1);

llLookAt(vTarget + <0,0,vOffset.z>, 1, 0.1);

// llMoveToTarget(vTarget, 0.5);
llSetTimerEvent(0.0); // turns off the die timer
}
touch_start(integer total_number)
{
llSay(0, "stopit.");
}
}
Kayaker Magic
low carbonated footprint
Join date: 11 Sep 2008
Posts: 109
05-27-2009 08:20
If your follow-me is a sculptie you can re-make it to have the end you think of as the forward end point up the local Z axis. In Blender, for example, you can import the sculptie, rotate it and save it back out as a new sculptie texture.
Jordon Bernard
Registered User
Join date: 30 Nov 2007
Posts: 3
05-27-2009 08:50
From: Kayaker Magic
If your follow-me is a sculptie you can re-make it to have the end you think of as the forward end point up the local Z axis. In Blender, for example, you can import the sculptie, rotate it and save it back out as a new sculptie texture.


Thank you for your suggestion. The scultpy is a full perms map that I purchased. Have no ability to create or edit a map other then apply it to a prim. So that would not work for me.
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
05-27-2009 09:29
you can rotate the sculpt by opening the map in a photo editor such as gimp or photoshop. i saw someone explain it on a different thread a couple weeks ago, but i forgot where it was, buti think it was involving llLookAt as well

edit: if the map is full perms you can save it to your harddrive, just open it as a texture, then on the file menu, save texture as

edit again: here it goes /54/d2/317144/1.html#post2395997
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Dekka Raymaker
thinking very hard
Join date: 4 Feb 2007
Posts: 3,898
05-27-2009 09:32
place the script in a prim with the appropriate axis hidden inside the sculpty?
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-27-2009 10:12
From: Dekka Raymaker
place the script in a prim with the appropriate axis hidden inside the sculpty?

probably the easiest solution here... I know how to rotate a sculpt map around the z axis, and even flip the z axis without just turning it inside out, but a don't know a simple way to change the +x to face +z in with a simple image manipulation.

alternatively, you could use rot look at (which operates on the fwd axis, not the up one), although this isn't going to let a moving object point towards the target unless you constantly update your target rot for the new relative position.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -