<div dir="ltr">Hiya,<div><br></div><div>Sorry for bumping up this thread. I have a similar issue, but my setup prevents me from scripting every object in sight to detect collisions. Let me explain why.</div><div>
<br></div><div>First, I'm trying to make my solution compatible across SL and OpenSim, while developing most of the code in OpenSim: the theory is that if it works in OpenSim, it should work even better in SL (based on the theory that OpenSim only implements a subset of LSL except for OS-specific functions, of course). So, keeping things simple, and making them work in OpenSim, should ensure compatibility with SL later on. That's the first assumption.</div>
<div><br></div><div>The second one is that llCastRay() is, at best, tricky to find things, and, at worst, useless. Here, neither SL nor OpenSim are "perfect". SL's llCastRay() seems to give slightly better results, but they're "not as good as advertised" when the ray is being cast from a moving avatar, i.e. from inside an attachment. (The alternative, using sensors, can be often worse and has all the other known limitations).</div>
<div><br></div><div>The third assumption is that the world is full of unscripted objects, and the scripts will have to deal with them all to have minimally accurate "vision". So I cannot use dz's approach, which is to drop a script inside each and every object in a 15,000-prim area (yes, my scripts need to navigate across all that), and expect them to send collision events via llSay(). It's simply unfeasible. There is an old Indian Buddhist saying that goes, "If the roads hurt your feet, the solution is not to wrap the whole world with leather to make all surfaces soft, because that's impossible; instead, wrap just a little bit of leather across your feet, and you can walk all roads without hurting yourself". A very good similarity applies to this case, IMHO: it's a bit pointless to make sure *all* the world is scripted for collisions, when you just need to test collisions on one's attachments.</div>
<div><br></div><div>So what I'm doing is a mixed approach. First, I cast a ray, to get a list of what OpenSim (or SL) _thinks_ is ahead of the avatar. But sometimes the ray will just send back wrong/incomplete information, and the avatar in the case where no human is behind it, of course hits a wall. In that case, I wish the attachment to detect the collision and report back to the system, and flag an exception we thought the way was clear, but it isn't. Also, this approach means that the script doesn't need to be sending rays in very short time frames just once in a while, assuming most of the environment will remain static, and deal with exceptions (or cast new rays!) if it starts bumping into things.</div>
<div><br></div><div>This works well enough in SL, but apparently not in OpenSim: apparently, without any special tricks, it seems impossible to get collision events in an attachment to work (at least on 0.7.5 Dev). Why?</div>
<div><br></div><div style>If there are any special tricks to get this working, what are they?</div><div style><br></div><div style>Will switching to 0.7.6 Dev make any difference? (As far as I can see on the Mantis and/or searching via Google, nobody seems to be mentioning this). Will this be implemented in BulletPhysics? (I'm not even sure if BulletPhysics already works under Linux these days...)</div>
<div style><br></div><div style>I'm also looking for an alternative using libopenmetaverse. The simulator definitely sends *some* messages to the viewer when there is a collision with the avatar. However, it's not that obvious how to catch the reverse situation: when the avatar collides with an object :-(</div>
<div style><br></div><div style>Any further suggestions are most welcome!</div><div style><br></div><div style> - Gwyn</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On 24 March 2013 16:11, dz <span dir="ltr"><<a href="mailto:dz@bitzend.net" target="_blank">dz@bitzend.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I would have to qualify my answer, given your response.. <br><br>The NPC collisions I deal with involve avatars bumping into various objects in the course of them walking and running about in a region. The majority of my sensors are at street intersections where I can make the NPC to react to red/green lights, or send them off in another direction. I also use them to trigger pause and reach animations for doors, or sometimes trigger reactions when encountering "Special" NPC's. The speed of the moving avatar is much lower than the speed of a bullet, and the solution I use limits the number of objects in a sim that cause reactions. Too many scripted objects / simultaneous collisions can be a serious performance issue.<br>
<br>I have not attempted to apply this design to an object like a bullet. My understanding is that best SL solution to that problem it to use the orientation of the gun ( or gun sight ) and location of the target to pre-determine if the bullet will hit/miss. Scripters in SL are using the llCastRay function to perform this
intersection determination. [ I cant say if or when llRayCast is/will be implemented in OpenSim,
or what its performance would be like compared to SL.] The bullets are still expended, but in order to minimize the accumulation of spent ammo, the bullets just "fly and die", removing themselves after a brief period of time. In that instance, you can certainly have the GUN broadcast a HIT message to the avatar, but I don't think its a good plan to script bullets to be generating and processing collision events.<span class="HOEnZb"><font color="#888888"><br>
<br><br><br>D<br>
</font></span><br>_______________________________________________<br>
Opensim-users mailing list<br>
<a href="mailto:Opensim-users@lists.berlios.de">Opensim-users@lists.berlios.de</a><br>
<a href="https://lists.berlios.de/mailman/listinfo/opensim-users" target="_blank">https://lists.berlios.de/mailman/listinfo/opensim-users</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br>"I'm not building a game. I'm building a new country."<br>
-- Philip "Linden" Rosedale, interview to Wired, 2004-05-08
</div></div>