Zero Rotation Problem
|
|
Akari Armitage
Registered User
Join date: 20 Aug 2004
Posts: 6
|
08-04-2006 19:07
I am trying to make a linked obect rotate towards someone but when you sit on it, the sit script sends a linked message telling the lookat script to stop looking at the person. When the lookat script gets told to stop, i want the whole object to go to Zero Rotation. My problem is the linkset rotates towards the person as they are sitting, this makes the prim move right before going to zero rotation, sometimes even sending them prim underground. Here is the Lookat script. Any help would be great. string move = "move"; string stop = "stop";
startup() { llSensorRepeat("",NULL_KEY,AGENT,10,PI,.5); }
default { state_entry() { startup(); } sensor(integer total_number) { vector pos = llDetectedPos(0); llLookAt(pos, 1 , 1); } link_message(integer sender_num, integer num, string str, key id) { if(str==move) { llResetScript(); } if(str==stop) { llSetRot(ZERO_ROTATION); llStopLookAt(); llSensorRemove(); }
}
}
|
|
Shack Dougall
self become: Object new
Join date: 9 Aug 2004
Posts: 1,028
|
08-04-2006 20:08
From: Akari Armitage if(str==stop) { llSetRot(ZERO_ROTATION); llStopLookAt(); llSensorRemove(); }
}
} Try putting the llStopLookAt() before llSetRot(ZERO_ROTATION);.
_____________________
Prim Composer for 3dsMax -- complete offline builder for prims and sculpties in 3ds Max http://liferain.com/downloads/primcomposer/
Hierarchical Prim Archive (HPA) -- HPA is is a fully-documented, platform-independent specification for storing and transferring builds between Second Life-compatible platforms and tools. https://liferain.com/projects/hpa
|
|
Akari Armitage
Registered User
Join date: 20 Aug 2004
Posts: 6
|
08-04-2006 20:25
i moved the llStopLookAt() before llSetRot(ZERO_ROTATION); and it still moves when sit. =(
|
|
Shack Dougall
self become: Object new
Join date: 9 Aug 2004
Posts: 1,028
|
08-04-2006 21:12
From: Akari Armitage i moved the llStopLookAt() before llSetRot(ZERO_ROTATION); and it still moves when sit. =( Just to make sure that I understand. The object rotates toward the person as they are sitting. But does it finally go back to ZERO_ROTATION after they sit? If you don't need it to rotate in all dimensions, one possibility is to restrict the rotation. For example, restrict it so that it only rotates around the Z axis using llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, FALSE); in the startup() function. This would probably prevent it from rotating underground, but it might also ruin the effect you were trying to achieve with llLookAt.
_____________________
Prim Composer for 3dsMax -- complete offline builder for prims and sculpties in 3ds Max http://liferain.com/downloads/primcomposer/
Hierarchical Prim Archive (HPA) -- HPA is is a fully-documented, platform-independent specification for storing and transferring builds between Second Life-compatible platforms and tools. https://liferain.com/projects/hpa
|
|
Akari Armitage
Registered User
Join date: 20 Aug 2004
Posts: 6
|
08-04-2006 21:36
what is happening is when a person sits they move to the vector in the sit script. while they are moving to this location the lookat function rotates the whole object. at the same time the setrot does a zero rotation. this causes the prim to move, not just rotate, in normaly the direction of the vector offset of the sit script. the bigger the offset in the sit script the farther the object moves when you sit.
i tried the llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, FALSE); and still the prim moves =(
|
|
Thanto Usitnov
Lord Byron wannabe
Join date: 4 Aug 2006
Posts: 68
|
08-04-2006 22:57
It looks to me like the rotation before sitting problem is caused by your telling it to keep rotating until it's sat on. When a person is directly above it, IE: when a person goes to sit on it, it rotates into an undesirable position (you can test this yourself by flying closely above it). The only way I can think to fix this is to somehow make it stop looking *before* its sat on, IE: it should ignore any objects within a certain distance.
Also, you might want to check that your conditionals are actually running. I usually do that by putting something in the logic blocks that sends a message that say what conditional the message sending thingy is in that got run. You could do that with llOwnerSay here.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
08-04-2006 23:00
Are you sure the link message is getting through as you expect? Try adding a 'llOwnerSay()' debug line. Also, it might POSSIBLY help to slow the sensor repeat down as the target gets closer (or just overall) so they have some maneuvering time, so to speak. 
|
|
Akari Armitage
Registered User
Join date: 20 Aug 2004
Posts: 6
|
08-04-2006 23:27
100% sure the link message is getting threw, because if it wasn't and the lookat was still running the object would rotate wildly when i was sitting on it. (i tested this ^_^)
|
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
08-05-2006 11:20
hmm... I guess this is an old known issue... refer to this thread.
_____________________
 Seagel Neville 
|