Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Ball-on-a-chain Physics?

Linysse Steinhardt
Registered User
Join date: 30 Jul 2006
Posts: 6
07-31-2006 16:37
In what is perhaps a noob question:

How would one go about linking prims together in a non-rigid manner?

For example: Suppose that I'm creating, say, a lantern on a stick. I want the stick to be carried around, and the lantern to hang from the end of the stick on a chain. However, I want the lantern to be pulled downward by gravity, and to swing around as the stick is moved.

Is there a way to attatch the lantern to the stick so that the lantern behaves as a tethered, physical object? (Or would this require two, seperate objects, attatched by a script? Or would I have to animate it manually?)

Thanks for your help, and your patience.
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
07-31-2006 16:59
You won't like this answer, but there are two reasons you can't do this with physics. First, physics are disabled on all objects attached to avatars (so that attachments won't interfere with the physics on the avatar itself). Second, physics-enabled chain-type objects are especially difficult to make. The collision lattice around every prim is larger than the prim itself (.05M larger in each direction, I think), meaning each chain links has to be huge in order for its hole (AND the corresponding holes in its collision lattice) to allow enough space for the next link to collide properly within it.

You can, however, fake the effect, and there are two ways to do that. First, you could use a fliexi prim. If it's well textured, and its settings are well adjusted, it might give you the effect you're looking for. It might be difficult to keep the lantern part stiff while allowing the chain part to sway, since they'll both be textured onto the same prim, but play around with it, and you can probably make it work reasonably well.

A more acurate way to do it is to use the sculted equivilent of framed animation. That is, build several versions of you lantern/chain assembly in several different positions, one for each "frame" of the total animation sequence. Then link the whole thing together, and script the object to to turn visibility on and off in sequence for the various prim groupings that make up each position. If it's well constructed, and well timed, the effect should be fairly convincing. This is how the tails on a lot of furry avatars are done if you want to look for some examples.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
07-31-2006 17:42
From: Chosen Few
The collision lattice around every prim is larger than the prim itself (.05M larger in each direction, I think)


0.1m :)

http://secondlife.com/badgeo/wakka.php?wakka=physics
Linysse Steinhardt
Registered User
Join date: 30 Jul 2006
Posts: 6
07-31-2006 18:10
You're right. I didn't like that answer. ;/

Hmmm. However . . .

If I compromise with the reality of the situation, and replace the chain with a rope, using a flexi-prim gives me the perfect effect I'm looking for. However, there's still the matter of the lantern on the other end . . .

Is there really no way to attatch anything to the end of a flexi-prim? If attatching objects to one's person disables its physics, can I treat the lantern as an independant object and attatch it with a script?

(I'm hesitent to animate the lantern directly, because I want an object that can account for various animations I may encounter that I don't plan for. It seems that physics would be a much more efficient way to do this.)

I expect that I won't enjoy this answer either. Either way, thanks for your help.
Graiser Lightworker
Registered User
Join date: 13 Dec 2005
Posts: 38
07-31-2006 18:43
I don't know if this will help, but if you have a texture of two links of chain...
and knowing you can tell an object to maintain a position relative to you, (look for follow scripts, and hack away)
and knowing some people use particle effects to make leashes...

It won't look QUITE right, unless you figure out how to make it spawn the particles, then hold them there, (I believe it's possible, but I don't know that,)

As for making the lantern sway. You need to make the thing maintain a position relative to you, plus or minus a bit, and let it oscillate. I don't know if this is an answer, but if I were trying to do what you're describing, this it the path my experiments would take.



P.S. edit.
Some other things you could try would be making a large chain, getting it linked up, and physical, then shrinking it. I've not tried.
Also, if you have a lantern on a rope or chain, it's going to pull that thing pretty tight in most cases. Perhaps just show a taut chain with a lantern on the end of it, and let the chain pivot relative to the end nearest you.
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
07-31-2006 19:15

Thanks, Osgeld. At least I was half right. :D

From: Graiser Lightworker
Is there really no way to attatch anything to the end of a flexi-prim?

Nope, no way to do that. Flex is only a client-side graphical effect, not a physical effect that the server is aware of in any way. Were you to link another object to the flexible end (which, again, you can't do), it would simply stay in place while the object it's attached to appears to flex.

However, if you set it just right, you can have the flexi object appear to bend just in the middle with both ends remaining rigid. If you use a well-textured, hollow cylinder, you might be able to make it look semi-convincing from most angles as a lantern on the end of a rope or chain. I'm not inworld to test this right now, but I'm fairly certain it's doable.

From: Graiser Lightworker
If attatching objects to one's person disables its physics, can I treat the lantern as an independant object and attatch it with a script?

You could have it follow the rope, but it will be on a bit of a delay, and it won't know that the rope is flexing.


Unfortunately, as you're starting to discover, as excellent as SL is as a platform for all kinds of things, it's not really great at any one thing in particular. It can do physics simulations, but only to a degree, it can do 3D modeling, but only to a certain extent, etc. The good news is that because we deal with these limitations every day, we all tend to get "programmed" to be pretty liberal when it comes to suspending our disbelief. Pretty much anything you make that even remotely resembles a lantern on a rope will be believable enough for us brain-trained SL'ers.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
Raideur Ng
Dr. Robotnik
Join date: 22 Mar 2006
Posts: 15
08-02-2006 09:49
I can think of a pretty "fake" but possible way to use flexiprims to "attach" something bigger to the end of a flexprim. Another flexprim.

You have your rope, its however long, its probably round. Duplicate it and place it as the same coordinates. Change it into a box. Cut the box so only the end that wags around alot remains, texture as needed. the box will follow the same flex pattern as your rope (pretty much) and will look like its stuck on the end.

I havent tried this, but I see no reason it wouldn't function.
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
08-02-2006 10:19
Good idea, Raideur, but wouldn't you have to dimple the box, not cut it? Obviously, we can't get inworld right now to test this, but the flex is always along the local Z axis, right? Simply cutting the box would remove a side or two, not the top or bottom. Seems to me the procedure would be to start with a sphere, dimple it to remove the top half, then change it to a box, and then apply the flex settings.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
Linysse Steinhardt
Registered User
Join date: 30 Jul 2006
Posts: 6
08-09-2006 07:11
Hmm. That might actually work pretty well; once maintenance finishes I'll be heading back in to try this.

Thanks for your help!
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
08-09-2006 08:08
You might also want to check out the XCite main store, they have a "ball and chain" for slave ankles.. it involves some pretty interesting scripting from what I can tell (probably involving the basiscs of the bananaphone in reverse) with a particle chain connecting the two. A lot of the leash collars work in this way, allowing an avatar wearing the "collar" to be limited in distance from a "leash handle" worn by the dominant's avatar.

But my basic understanding is, you can do quite a bit of cheating of this using some advanced scripting.. a "floating" prim that is attracted to the location of a prim held by an avatar.


you could also make a rigid rope (taught from the weight of the lantern after all) and a rigid lantern.. and combine all those into a single "object".. and write a small script that would "pivot" the rope at it's top, and swing it back and forth slowly.