opening a hinged box lid?
|
|
Justin Ersetu
Registered User
Join date: 4 Jan 2007
Posts: 5
|
01-04-2007 21:29
I've been looking through the forums, but can't find how to do a box opening its lid...
I've seen a few door examples, and thinking the top of the box might could recycle a door script just swinging on a different axis. Can anyone spare a newbie a tip?
Thanks in advance!
|
|
Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
|
box lid
01-04-2007 22:46
If you make the lid prim the same as you have to do doors, then you can make is function basically the same.
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-05-2007 00:40
|
|
Justin Ersetu
Registered User
Join date: 4 Jan 2007
Posts: 5
|
01-05-2007 01:00
thank you so much both! 
|
|
Damanios Thetan
looking in
Join date: 6 Mar 2004
Posts: 992
|
01-05-2007 01:10
Option 1: If you use a flat lid (like a door), you can use a normal door script. To make all doorscripts function correctly the lid/door needs to be cut in half, so the axis of the prim seems to be on the 'side'. (E.g. use a cut of 0.375/0.625) Make sure you use one which still functions correctly after linking. A lot of door scripts tend to not take the root prim rotation into account of a linked set. Option 2: If you want to use a different shape as a lid (e.g. half a cylinder etc.) what you need is a rotation over a different axis than the normal central axis. You can do this easiest by combining a move and rotation using llSetPrimitiveParams . Information about how to do a rotation over an arbitrary axis can be found in the lsl wiki (rotations) Remember that llSetPrimitiveParams uses global coordinates, where llSetLocalRot,llSetPos uses local coords based on the root prim. It's possible to use llSetLocalRot/llSetPos too (no need to recalculate from local coords to globals), but the rotation will be less smooth. You can also use option2 to create a lid made of multiple prims. You need a slave script in each prim, which does the actual rotation, and a master script, which sends linked messages to the slaves, containing the center of rotation. The suggested way of using delink/link makes the rotation/offset calculations a lot easier, but requires a LOT of 'maintenance' code. (To make sure everything goes well when moving/deleting/taking the object(s))
|
|
Justin Ersetu
Registered User
Join date: 4 Jan 2007
Posts: 5
|
01-05-2007 14:24
Thank you Damanios! At this point in scripting, some of it sounds really greek. I'll definitely look through and study what you said. Maybe one day, it will come second nature. Thank you so much for your help.
|
|
Baron Hauptmann
Just Designs / Scripter
Join date: 29 Oct 2005
Posts: 358
|
01-06-2007 06:20
From: Damanios Thetan Option 1: If you use a flat lid (like a door), you can use a normal door script. To make all doorscripts function correctly the lid/door needs to be cut in half, so the axis of the prim seems to be on the 'side'. (E.g. use a cut of 0.375/0.625)
Make sure you use one which still functions correctly after linking. A lot of door scripts tend to not take the root prim rotation into account of a linked set.
Not all doorscripts require the half-cut. I have made a script for an uncut door which rotates as a child in a linkset. And it works well for a box lid, too. The process just requires a bit more math and tweaking, but especially for a box lid, you may not want to use the normal "door cut". Baron Hauptmann
|
|
WindyWeather Vanalten
Registered User
Join date: 27 Nov 2006
Posts: 53
|
An example at Naiad 161,199,22
01-06-2007 12:25
There is an example of a box with hinged lid that works at any angle. Free to take at: Naiad 161,199,22
Look in the yard near the house for a brown box with an informative floating text line above it.
Cheers,
wwv
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
01-06-2007 12:32
If it is small, phantom or an attachment, you can just use the trick of having one lid prim in the "open" position, one in the "closed" and using llSetLinkAlpha (or other method) to make the unwanted lid invisible. Obviously in the case of a large object that is not phantom, people will bump into the invisible lid, which is not ideal.
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!
http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal
http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
|