Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

A box with a lid

Daisy Rimbaud
Registered User
Join date: 12 Oct 2006
Posts: 764
12-03-2006 06:41
This is a very beginnery sort of problem but I can't quite get my head round how to achieve the effect I want.

I'm building a box with a lid. I want it to open when the lid is clicked. The script is in the lid. I have the thing working nicely until I link the prims together, then depending on which prim is parent, either the whole box moves instead of just the lid, or nothing moves.

I assume I could move the script to another prim, make that the parent, and have it send a message to the lid to move, but then it would no longer work when you clicked the lid, you would have to click whatever was the parent prim.

What's the best solution to this, please?
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
12-03-2006 07:25
When you link the box prims together, the lid cannot be the root prim, otherwise, it will rotate the whole box, no matter what.

Also, in your script, you need to use llSetLocalRot instead of llSetRot. You may have to use different parameters to compute the position and rotation, since llSetLocalRot is root-relative.
Daisy Rimbaud
Registered User
Join date: 12 Oct 2006
Posts: 764
12-03-2006 08:25
Thanks. My problem was I was using llGetPos instead of llGetLocalPos. Sorted now.