Why doesn't llPassCollisions(FALSE) allow child to see collisions.
|
|
AnnMarie Otoole
Addicted scripter
Join date: 6 Jan 2007
Posts: 162
|
03-10-2008 12:59
Child prim has a collision_start event handler. (Tests OK when not linked) (Parent has collision_start too but only put there for debugging and reporting collisions.) Child prim has the llPassCollisions(FALSE); statement executed on startup/rez. The object is worn. With llPassCollisions(TRUE), collisions do get passed to the parent. With llPassCollisions(FALSE), neither child or parent sees collisions.
The only Wiki factor not covered in the llPassCollisions function description that may be different is this object is worn and I assumed that was OK since there is no reference to that.
Any other experience on this here?
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
03-10-2008 14:59
From: AnnMarie Otoole The object is worn. I think that would be your problem. How is anything going to collide with the child prim? Things don't even really collide with the root prim; they collide with the avatar. Child prims ONLY get collision events when an object/avatar collides WITH THAT PRIM. We happen to have the useful "feature" that attachment root prims get collision events (and it's a good thing, since you can't put a script on an avatar directly  ).
|
|
AnnMarie Otoole
Addicted scripter
Join date: 6 Jan 2007
Posts: 162
|
03-10-2008 15:36
Thanks Hewee but the child projects 5 meters out in front of the avatar. It will collide with objects before the Avatar reaches them like a blind man's walking stick. If the child prim is worn without the parent it works fine so I don't think wearing it should be a problem.
I have a solution that I know will work, I can make the child the parent and it can adopt the parent as a child. But it is messy, requires a lot of re-programming and the llPassCollisions(FALSE) "should" work although you're never quite sure in lsl.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
03-10-2008 17:32
Unfortunately, attachments do not change the collision geometry of the avatar which is a rectangular prism the size of llGetAgentSize() when the avatar is not sitting. You cannot detect when an attachment intersects another object or avatar, in large part because it depends on the animations that are played client-side. Instead, attachments get collision events when the avatar collides with other object or avatars.
|
|
AnnMarie Otoole
Addicted scripter
Join date: 6 Jan 2007
Posts: 162
|
03-10-2008 18:15
If the attachment projects beyond the agent (size) it DOES detect the collision before the agent would have. That part works fine when worn as an attachment. It DOES change the collision geometry. The collision event DOES occur in the worn prim up to 10 meters ahead of the avatar (prim size limit). It just ceases to work when it is the child of another worn item despite blocking the collision event from passing to the parent.
I could leave it as a worn prim and it would work, however I already had another (somewhat unrelated) attachment on the avatar so to save using up an extra attachment point I made it a child of the existing one. That should work so long as I block the collision event from passing to the parent - but it doesn't work.
So like so many things in lsl I'm working around it. I'm combining the scripts of both items into a single prim so now it is childless which I know will work but the script structure and the object structure is a bloody mess instead of two clean working objects.
I guess, since the Wiki does not say anything about it failing to work when worn, it is either a bug or a lack of documentation.
I'll make a simple demonstrable sample and submit it as a bug unless I can find a logical explanation that I'm overlooking.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
03-10-2008 20:06
You may want to test that. Here's a good setup. Make a sphere with scale 5m x 5m x 5m. Name it "MyAttachment" and attach it to your pelvis and move it as far out in front of you as possible. Put this script in it: default { collision_start(integer nDetected) { integer i; for (i = 0; i < nDetected; ++i) { llOwnerSay("Collsion with '"+llDetectedName(i)+"'"); } } }
Now make a box with dimensions 1m x 5m x 5m. Name it "MyWall". Walk slowly forward into the wall. You'll see the sphere disappear behind the wall, and you only get the message when your avatar itself bumps and stops. Now, make the wall physical. You'll find you get the same results. Now add the following script to the physical wall: default { touch_start(integer nDetected) { vector pos = llGetPos(); rotation rot = llGetRot(); llRotLookAt(rot, 0.1, 0.1); llMoveToTarget(pos+2.0*llRot2Fwd(rot), 0.5); } }
Stand on the (local) +x side of the wall, face it, and touch the wall a few times. Again you'll see the wall will move to the center of your sphere without a collision reported. The output comes when it bumps your actual avatar.
|
|
AnnMarie Otoole
Addicted scripter
Join date: 6 Jan 2007
Posts: 162
|
03-10-2008 21:13
Hmm OK cool.
I need to test at a much slower speed so I can see what is actually happening. The way I was doing it I could not tell the time difference of when I get the collision and when the prim and subsequently the avatar collided. So my work around of putting both scripts in the same prim should work OK since it appears you can't pass the collision event from a parent to a child. And I'll have to give up on getting the early warning.
Thanks for your patience.
|
|
Alex Lulu
The One and only
Join date: 3 Jun 2005
Posts: 9
|
03-20-2008 07:03
there is no way that you are passing a collision with a attachment on a avatar its been that way for years
all attachments are phantom
|