|
Ernst Osterham
Registered User
Join date: 29 Oct 2008
Posts: 26
|
12-07-2008 18:41
I'm working on a project involving a record player in which I want the record dics to be separate objects. Is there any way to have a script in either the player or the disc so that when a disc is rezzed it will automatically position itself on the spindle of the player somehow?
|
|
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
|
12-07-2008 19:15
The quick answer is yes. If you look at the llRezAtRoot function you will see the what you need. Of you can get fancy and use the llMoveToTarget and give the effect of moving from a stack to the player.
|
|
Ernst Osterham
Registered User
Join date: 29 Oct 2008
Posts: 26
|
12-08-2008 01:09
Great, the llMovetoTarget seems right what I'm after. One problem I'm having is that I have to make the object physical for it to move, but once it's in place I want to make it non-physical again and my script doesn't seem to ever get that part to work. I think it should be checking the position of the target against it's own position because once the two are the same it needs to become non-physical again, but for some reason it never becomes non-physical.
default { state_entry() { vector pos = llGetPos(); llSetStatus(STATUS_PHYSICS, TRUE); llSleep(0.1); llMoveToTarget(pos,0.1); llSensor("Target", NULL_KEY, 4, 20.0, PI); } sensor(integer total_number) { vector pos = llDetectedPos(0); llMoveToTarget(pos,0.1); if (llGetPos() == llDetectedPos(0)) { llSetStatus(STATUS_PHYSICS, FALSE); } } }
|
|
Kerik Rau
Registered User
Join date: 8 Mar 2007
Posts: 54
|
12-08-2008 01:14
From: Ernst Osterham Great, the llMovetoTarget seems right what I'm after. One problem I'm having is that I have to make the object physical for it to move, but once it's in place I want to make it non-physical again and my script doesn't seem to ever get that part to work.
Just use llSetPos(), it will move the object (up to 10m) without needing physics.
|
|
icktoofay Kamachi
Registered User
Join date: 10 Nov 2007
Posts: 17
|
12-08-2008 18:04
Try checking if the object is within, say, 0.1m of the target instead of checking if it's exactly at the target. Then you can turn off physics and use llSetPos to move to that exact position.
|