Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Prim Follow prim.

InuYasha Meiji
Half Demon
Join date: 14 Mar 2005
Posts: 127
03-04-2006 03:40
I script very little, and ned a little help. could someone show me, or point me in the right dirrection to get one prim to just follow another prim closely?

I don't want to link them, I just want to wear an object and have an unattached prim follow that attached prim.

Spent all morning trying to figure out what to type in the Wiki search or the forums to get such information. I appreciate any help.

-InuYasha Meiji
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
03-04-2006 05:54
From: InuYasha Meiji
I script very little, and ned a little help. could someone show me, or point me in the right dirrection to get one prim to just follow another prim closely?

I don't want to link them, I just want to wear an object and have an unattached prim follow that attached prim.


You can't easily follow an attached prim, since they can't be detected apart from the position of the avatar. (Actually, I suppose it's possible that if you knew where the attachment point was, you could have the attached prim continually announce it's getLocalPos and then the follower could work out the actual position based on the location of the av.. but that would lag a lot I think)

But basically what you'll do is to use an llSensorRepeat to find the thing you want to follow, and then when it's found (ie, inside the sensor event), have the following object move (via llSetPos if it's not physical or llMoveToTarget if it is) to the location of the detected object (gotten via llDetectedPos) plus an offset to prevent it actually crashing into the object rather than following it.

If you want exact code, say so and I'll post it up, but after the errors with the name scanner I want to actually be where I can test it this time! :)
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
03-04-2006 09:33
Since you can't actually detect attachments, I would use llKey2Name, with the attached object changing its name to its position frequently. Basically, the attachment would rez an object, which would have a listen open for a moment in order to hear the key of the object that rezzed it. Then, both objects would have timers. The attachment would repeatedly set its name to its position, and the follower would repeatedly use llKey2Name to get this position and follow it.
InuYasha Meiji
Half Demon
Join date: 14 Mar 2005
Posts: 127
Saddle Idea
03-06-2006 18:30
See, I was hoping for a rideable prim like a saddle. I was told that you can't just attach a prim and have another AV sit on you. So I had the idea that maybe if I attached an oject with a close follow object that the other AV could ride the follow object.

Any Ideas? I want to make a pigy back riding type of thing. I could carry my wife on my back and run to a place. Just something fun.

-InuYasha Meiji
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
03-07-2006 00:27
As far as I know, most solution using this technique just scan for the avatar wearing the saddle (or whatever) rather than the saddle itself.

You can find out where the other av is, and in which direction they're facing (more-or-less**) and add a fudge-offset to get the position right.

** you may need an AO in the saddle to limit the wearer's head movement, and to make sure that they do not play any animations that turn the body away from the default facing forward orientation.