Why doesn't collision_start work?
|
|
AnnMarie Otoole
Addicted scripter
Join date: 6 Jan 2007
Posts: 162
|
07-22-2008 23:41
The collision_start Wiki definition says:- Triggered when task starts colliding with another task. The Glossary says a task is:- Server-side representation of a primitive or link set. Nowhere in the definitions does it say colliding objects have to be physical. Is this an error in the Collision Wiki or a bug? Test:- Make a 10 x 10 x 1 cube. Make a second 1x1x1 cube and position above but not touching the first cube. Add script to the small one:- default{ state_entry{ llSetTimerEvent(1); } timer(){ llSetPos(llGetPos() - <0,0,0.2>  ; //Move it down until it collides. } collision_start(integer num){ llOwnerSay("Collision"  ; llSetTimerEvent(0); } } It only works if the bottom cube is physical.
|
|
Urrong Urnst
Registered User
Join date: 12 Jul 2008
Posts: 49
|
07-22-2008 23:50
llSetPos() is like moving object/primitive in the building edit window. It wont start collision. It works when bottom primitive is physical because when small prim gets into the big prim's physical bounding box it makes it move and collide with the small prim. To avoid this u can make small prim physical for the time it is moving and use llMoveToTarget() function.
|
|
AnnMarie Otoole
Addicted scripter
Join date: 6 Jan 2007
Posts: 162
|
07-23-2008 00:24
Hmm thanks Urrong. That makes sense but the orientation of the prim must be precise and making it Physical will destroy that. And correcting orientation after it stops and goes non-physical will upset the height detection which has to be correct within 0.005. I guess I could have the upper one rez and drop a micro size , temporary, physical sphere. It could transmit the .z data when it collides and then the upper object could do the llSetPos(). Now that's messy 
|
|
Urrong Urnst
Registered User
Join date: 12 Jul 2008
Posts: 49
|
07-23-2008 00:47
Well that is one option. But depent on what realy do u need to do. Maybe there are some events that would take care of your problem. Or maybe there is another solution because rezzing small temp prim just to trigger collision event is not a good idea. If you would need some functions to happen when prim moved down u could use timer or at_target event.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
07-23-2008 00:54
ONE of the objects must be physical, yes. The other one need not be.
|
|
AnnMarie Otoole
Addicted scripter
Join date: 6 Jan 2007
Posts: 162
|
07-23-2008 01:02
A simplified description is to think of a table cloth being dropped on a table. It has to sense the height of the top surface of the table so it lowers itself to the exact height to be over the table but under the utensils. It has to work on any table so I can't put script in the table. But by dropping the temporary microsphere from above it will detect the altitude at time of collision and send that information back to the table cloth. (So long as it doesn't land in a glass on the table although that won't be a problem in the actual situation). It seems like it is going to work OK. I think I have to adjust the height for the radius of the microsphere. Still testing.
|
|
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
|
07-23-2008 01:51
You can prevent a physical prim from rotating on any axis by simply setting the appropriate option. then your measurements will be as precise as they can possibly be.
|
|
AnnMarie Otoole
Addicted scripter
Join date: 6 Jan 2007
Posts: 162
|
07-23-2008 09:27
That is what I need but I can't find the "appropriate option". I would need a function to prevent any rotational motion so it will fall in the z axis only and maintain orientation. Is that one of the VEHICLE options? I need to do some more reading.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
07-23-2008 10:14
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
07-23-2008 10:20
From: AnnMarie Otoole That is what I need but I can't find the "appropriate option". I would need a function to prevent any rotational motion so it will fall in the z axis only and maintain orientation. Is that one of the VEHICLE options? I need to do some more reading. I think "llSetStatus (STATUS_ROTATE_X | STATUS_ROTATE_Y, FALSE);" might be what you're looking for.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
|
Urrong Urnst
Registered User
Join date: 12 Jul 2008
Posts: 49
|
07-23-2008 13:30
use all 3 rotation axes in llSetStatus so it would be: llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z, FALSE);
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
07-23-2008 19:34
From: AnnMarie Otoole ...height detection which has to be correct within 0.005... I haven't actually tried it, but that sounds like a pretty tight tolerance, just based on http://lslwiki.net/lslwiki/wakka.php?wakka=physics, "The minimum distance for objects to avoid collision (the spatial precision), is 0.1m (10cm)...." It's not exactly the same thing, but when I drop a physical object on the floor, it ends up hovering some distance above... is that distance a constant 0.1m? (Hewee's llGetBoundingBox approach would seem tidier.)
_____________________
Archived for Your Protection
|
|
Urrong Urnst
Registered User
Join date: 12 Jul 2008
Posts: 49
|
07-23-2008 23:00
I think it is not a constant. It depends on the prims size because if u drop 1x1x1 cm big sphere on the ground i think it wont float 0.1m in air. So the first thing u need to do is to get physical box and calculate the offset of the surface. I think it would be the best to make sphere non-rotational llike we said before and when physics enabled make script sleep for a few seconds do that sphere settles on the table. then make it non-physical and make other calculations.
|