Martin Spingflower
Registered User
Join date: 20 Apr 2009
Posts: 2
|
11-05-2009 04:20
Hi there,
I have to create a simple AI, so I created a robot (a sphere) which is patrolling and looking for intruders.
It's nearly complete. but:
1) I would like to visualize the area of the robots sensor (360°, 5m). So i created a ring (phantom) to indicate the sensor range. But: The ring has to be phantom, the bot to be physical and non-phantom. If i create a Link between both Objects, that doesn't work (because obviously, both have to have the same properties).
Are there any other ideas, how i could indicate the sensor range?
2) The Player of the game should be able to hide behind walls. But llSensor detects the Avatar regardless if he's behind a wall or in the line-of-sight of the robot. What would be the easiest way to respect the visibility of the avatar?
My idea would be to detect the walls as well as the avatar and to calculate if there is any shorter vector to a wall than the vector to the avatar... that doesn't sound like a handsome solution to me.
Are there any better ways?
3) At first try, i created a robot looking like R2D2 (Star Wars). I googled a lot, but i didn't find a way to move this robot with physics. I tried to move him as phantom as well as with physics, but the movement wasn't acceptable. The Problem was, that the robot tumbled all the time (his foots were 3 boxes). Are there any standard-movements to handle such objects? Now, it's just a sphere with llMoveToTarget()
- Martin
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
11-05-2009 07:28
From: Martin Spingflower 1) I would like to visualize the area of the robots sensor (360°, 5m). So i created a ring (phantom) to indicate the sensor range. But: The ring has to be phantom, the bot to be physical and non-phantom. If i create a Link between both Objects, that doesn't work (because obviously, both have to have the same properties).
Are there any other ideas, how i could indicate the sensor range? Particles might be a good bet - search places for the Particle Laboratory, in the Teal region IIRC. From: Martin Spingflower 2) The Player of the game should be able to hide behind walls. But llSensor detects the Avatar regardless if he's behind a wall or in the line-of-sight of the robot. What would be the easiest way to respect the visibility of the avatar? Maybe have the robot shoot a 100% transparent, llVolumeDetect'ed object towards the avatar. The llVolumeDetect will make an object phantom but it will still register collisions. If the first thing it hits is the avatar, there's no wall.. You'll need to do some sort of chat protocol so the shot object can tell the robot what it hit. From: Martin Spingflower 3) At first try, i created a robot looking like R2D2 (Star Wars). I googled a lot, but i didn't find a way to move this robot with physics. I tried to move him as phantom as well as with physics, but the movement wasn't acceptable. The Problem was, that the robot tumbled all the time (his foots were 3 boxes). Are there any standard-movements to handle such objects? Now, it's just a sphere with llMoveToTarget() "llSetStatus (STATUS_ROTATE_X | STATUS_ROTATE_Y, FALSE);" is your friend!
_____________________
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
|
Martin Spingflower
Registered User
Join date: 20 Apr 2009
Posts: 2
|
11-05-2009 08:11
Thank you 
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
11-05-2009 08:55
_____________________
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
|
Coldfire Nightfire
Registered User
Join date: 25 May 2008
Posts: 48
|
11-28-2009 20:54
From: 1) I would like to visualize the area of the robots sensor (360°, 5m). So i created a ring (phantom) to indicate the sensor range. But: The ring has to be phantom, the bot to be physical and non-phantom. If i create a Link between both Objects, that doesn't work (because obviously, both have to have the same properties).
[/QUOTE Hope this helps makes the child prim phantom //Phantom Child Script by Aeron Kohime //WARNING: When used on the root prim it makes the entire object phantom, it // also does not function correctly on tortured prims. (Sorry.) //Reset on Sim restart added by Void Singer //Strife Onizuka was here doing simplification //Reset on collision added by Taff Nouvelle (my stairs kept reverting) //Psi Merlin updated CHANGED_REGION_START (live as of Server 1.27) default { state_entry() { llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_BOX, 0, <0,1,0>, 0, <0,0,0>, <1,1,0>, <0,0,0>, PRIM_FLEXIBLE, TRUE, 0, 0, 0, 0, 0, <0,0,0>, PRIM_TYPE] + llGetPrimitiveParams([PRIM_TYPE])); } on_rez(integer s) { llResetScript(); } //-- This event/test will reset the script on sim restart. changed (integer vBitChanges){ if (CHANGED_REGION_START & vBitChanges){ llResetScript(); } } collision_start(integer num_detected){ llResetScript(); } }
http://wiki.secondlife.com/wiki/Phantom_Child
|
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
|
11-29-2009 00:23
What's not pretty about the distance solution? llVecDist() is fairly straightforward and easy to use. Also, why do you have to have a phantom ring and a non-phantom bot? The phantom child script will give you that, but what's the purpose of the ring?
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
11-29-2009 11:53
visualization, seeing how well it obeys it's limits
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|