Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help Rezzing Doors

MrRight David
Registered User
Join date: 5 Oct 2005
Posts: 8
01-07-2006 21:10
Hi, I am completely new to LSL but have been doing very well.. I have one problem that I just don't know where to turn to. I have a doorway that I've created a 'rez from inventory' script for that works great... until I turn the doorway and try to rez a new set of doors. What calculation/equation do I use to keep the Rez point 'Attached' to the doorframe so that it rezzes at the right location and right rotation to match the doorframe?

PLEASE... any help would be greatly appreciated!

Easier Explanation: I have a pencil that I rez the eraser on. Works great. I turn the pencil and rez a new eraser... not so great. Eraser matches pencil's rotation, but is no longer attached to the eraser end of the pencil that swung away because of turning it.
Jeff Caldera
Registered User
Join date: 12 Jun 2004
Posts: 11
01-07-2006 23:02
Try getting the position and vector of the door frame, and then using those coordinates to calculate where the door should rez.

llGetPos() and llGetRot()

btw hi David!

If you want to show me the script in world, I'll take a look. Or you can try reading here for a better explaination.
Lee Ludd
Scripted doors & windows
Join date: 16 May 2005
Posts: 243
01-08-2006 17:20
Put this script in an object, and put an object named "thing" in the object. It does what I think you want to do, although probably you'll want to offset the position.

CODE
 
default
{
state_entry()
{
llSay(0, "Touch to see the thing");
}

touch_start(integer total_number)
{
llRezObject("thing", llGetPos(), <0,0,0>, llGetRot(), 0);
}
}


MrRight David
Registered User
Join date: 5 Oct 2005
Posts: 8
04-23-2006 07:58
*Sigh* back again.. still the same problem that was never resolved and I'm pulling my hair out. I'm rezzing a linked set and that's what the problem is. It's a door with a 'hange' attached to the side. Rezzing always works fine if the rezzer is at ZERO_ROTATION, but once I turn the rezzer the door matches rotation, but is now offset from the rezzer itself.

I'm using:
llRezObject("Door", llGetPos() + <0, 0, 2>, ZERO_VECTOR, llGetRot(), 42);

Works flawlessly if the "Door" is a single prim cube, but once it's the real door with the hinge linked.. it blows up.. I know it's something with geometric center and all, but HOW do fix it so the linked set always rezzes 2m above the rezzer, with the correct rotation?

PS: Geometric center seems to be:
<-0.38810, 0.00010, 0.09865> if anyone wanted to know. ;)

-Dave