Avatar speed
|
|
Lewis Nerd
Nerd by name and nature!
Join date: 9 Oct 2005
Posts: 3,431
|
07-09-2006 09:55
Another wierd one.... is it possible to detect the speed at which an avatar is passing through a phantom object?
I'm thinking of making a speed trap to go with my road system I'm developing, so if any avatars go hurtling past beyond the speed limit, it sends them a picture of a speeding ticket, asking them to pay me L$25 fine.
Of course, I won't be enforcing these fines, and payment would be voluntary if the person feels guilty - but it's just one of those things that would give people a laugh.
Lewis
|
|
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
|
07-09-2006 10:08
From: Lewis Nerd Another wierd one.... is it possible to detect the speed at which an avatar is passing through a phantom object? llDetectedVel(), perhaps? Put it in the collision_start() event of that object, and enable llVolumeDetect() for it. edit: note, since llDetectedVel() returns a vector, you'll need to measure length of that vector with llVecMag() to get actual linear velocity.
|
|
Lewis Nerd
Nerd by name and nature!
Join date: 9 Oct 2005
Posts: 3,431
|
07-09-2006 11:15
Finally got it, thanks Live Help! default { state_entry() { llVolumeDetect (TRUE); }
collision_start (integer num) { vector vel = llDetectedVel (0); llSay (0, llKey2Name (llDetectedKey(0)) + " just passed thru at " + (string) llVecMag(vel) + " m/s"); } }
|
|
Lewis Nerd
Nerd by name and nature!
Join date: 9 Oct 2005
Posts: 3,431
|
07-10-2006 03:04
Ok... I've got a little problem now. I'm using the line llGiveInventory(llDetectedKey(0), "Speeding Ticket"); to give a ticket when it meets the conditions that require a speeding ticket. It works great with an avatar flying through the barrier. However, when you go through with a vehicle or something it tries to give the ticket to the vehicle and fails because of permissions. Is there a way to ignore objects, and just use the name of the avatar instead? Lewis
|
|
Raphael Rutherford
Resident Resident
Join date: 26 Mar 2004
Posts: 236
|
07-10-2006 03:41
llGetOwnerKey() should do it.
_____________________
Goodbye and thanks for all the prims.
|
|
Lewis Nerd
Nerd by name and nature!
Join date: 9 Oct 2005
Posts: 3,431
|
07-10-2006 03:56
From: Raphael Rutherford llGetOwnerKey() should do it. Will that still work if its just a flying avatar as well as a vehicle? If it's a car... then the car front hits the detector first, if it's a jetpack the avatar's head will hit the head first. Do I need to write a separate thing so if there's a problem with the llDetectedKey it'll tryllGetOwnerKey instead? Lewis
|
|
Ginge Reymont
Registered User
Join date: 10 Oct 2005
Posts: 190
|
07-10-2006 04:27
Check to see if its an avatar first..
|
|
Bitzer Balderdash
Dazed and Confused
Join date: 21 Dec 2005
Posts: 246
|
07-10-2006 04:35
llGetOwnerKey should work fine - avatars own themselves, so it will just return the same key.
|
|
Lewis Nerd
Nerd by name and nature!
Join date: 9 Oct 2005
Posts: 3,431
|
07-10-2006 05:07
Gah........ still getting problems. It works fine for me if I'm in a vehicle or not. However, when someone else goes through it, it doesn't pick up their name, and it gives me their ticket. Lewis default { state_entry() { llVolumeDetect (TRUE); }
collision_start (integer num) { vector vel = llDetectedVel (0); float vel2 = llVecMag(vel); if (vel2 >10)
{ llSetPrimitiveParams ([PRIM_POINT_LIGHT, TRUE, <1, 1, 1>, 1.0, 20.0, 0.25]); llSetPrimitiveParams ([PRIM_POINT_LIGHT, FALSE, <1, 1, 1>, 1.0, 10.0, 0.25]); llSetPrimitiveParams ([PRIM_POINT_LIGHT, TRUE, <1, 1, 1>, 1.0, 20.0, 0.25]); llSetPrimitiveParams ([PRIM_POINT_LIGHT, FALSE, <1, 1, 1>, 1.0, 10.0, 0.25]);
llSay (0, llKey2Name (llGetOwnerKey(llGetKey())) + " just got a speeding ticket for travelling at " + (string) llVecMag(vel) + " m/s along this stretch of road");
llGiveInventory(llGetOwnerKey(llGetKey()), "Speeding Ticket");
llSleep(10); llResetScript(); }
} }
|
|
Bitzer Balderdash
Dazed and Confused
Join date: 21 Dec 2005
Posts: 246
|
07-10-2006 05:14
that'll be because you are giving the ticket to llGetOwnerKey(llGetKey()) - which is the owner of the volume-detect prim! *grin*
try llGetOwnerKey(llDetectedKey(0))
also - you may want to check the number ot colliders and loop through them, not just use 0 all the time - which has the added advantage that you'll ticked every passenger in a vehicle *grin*
Other gotchers - if someone has borrowed a car, you'll ticket the owner, not the driver - which could get you AR'd if you send out demands for cash to people who weren't even anywhere near your land at the time and are totally unaware of what's happening.
|
|
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
|
07-10-2006 05:21
Hi Lewis
You need to replace llGetKey () with llDetectedKey (0)
llGetKey () returns the key of the prim the script is operating in. If it is possible that you might detect more than one key, put the whole thing in a for loop and cycle through "num" entries.
Ed
|
|
Lewis Nerd
Nerd by name and nature!
Join date: 9 Oct 2005
Posts: 3,431
|
07-10-2006 05:25
That does it  The speeding ticket is entirely humourous, and if you can get in-world in the next 15-20 minutes you're welcome to come and get a ticket yourself  I honestly don't think it would be AR'able... it's certainly not a demand as such, it just says pay up if you feel guilty. As I can't deduct money without asking permission, I don't really see it as griefing, and in fact whilst I've been out testing it several people have paid up because it game them a laugh. L$25 isn't a big deal after all is it? Lewis
|
|
Bitzer Balderdash
Dazed and Confused
Join date: 21 Dec 2005
Posts: 246
|
07-10-2006 07:53
Hey, I think it is a great idea, personally! I was just worried that if you didn't keep it obviously funny, some total idiot would take offence and AR you, which would be a real shame 
|
|
Raphael Rutherford
Resident Resident
Join date: 26 Mar 2004
Posts: 236
|
07-12-2006 08:47
From: Bitzer Balderdash llGetOwnerKey should work fine - avatars own themselves, so it will just return the same key. Isn't that a bug ? Shouldn't it return the key of Philip Linden? I sure feel pretty pwned by him sometimes.
_____________________
Goodbye and thanks for all the prims.
|
|
Raphael Rutherford
Resident Resident
Join date: 26 Mar 2004
Posts: 236
|
07-12-2006 08:49
From: Lewis Nerd .... and in fact whilst I've been out testing it several people have paid up because it game them a laugh. The next big thing in SL will be speed traps and laser guns!
_____________________
Goodbye and thanks for all the prims.
|
|
Bitzer Balderdash
Dazed and Confused
Join date: 21 Dec 2005
Posts: 246
|
07-12-2006 08:58
From: Raphael Rutherford The next big thing in SL will be speed traps and laser guns! Hey - careful, you can blind someone with one of those laser guns O.o 
|
|
Jesse Malthus
OMG HAX!
Join date: 21 Apr 2006
Posts: 649
|
07-12-2006 21:41
Oh man, evilist idea ever. Have a scripted speed limit sign that changes when it gives you a ticket, setting it lower, so even if you weren't speeding, you'd get hit >.<
|
|
Raphael Rutherford
Resident Resident
Join date: 26 Mar 2004
Posts: 236
|
07-14-2006 03:53
LOL ! I love that idea !!
_____________________
Goodbye and thanks for all the prims.
|