|
Para Actor
Registered User
Join date: 15 May 2009
Posts: 12
|
05-17-2009 05:10
does llMoveToTarget not work within collision_start?
I am making a script to make my object nabvigate a maze going around objects for a project for school concerning robots and virtual reality I am detecting the objects that my object is coliding with using collision_start but then I cannot avoid them but when my code reaches MoveToTarget the object does not move.
Does anyone know? thanks in advance. My object is physical so I am using llMoveToTarget not llSetPos
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
05-17-2009 07:03
Simple example: vector startPos;
default { touch_start(integer n) { startPos = llGetPos(); llMoveToTarget(startPos + <5,0,0>, 3.0); } collision_start(integer n) { llMoveToTarget(startPos,3.0); } }
Extended example: vector startPos; integer testTarget; integer startTarget;
default { touch_start(integer n) { llSetStatus(STATUS_PHYSICS, TRUE); llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z, FALSE); startPos = llGetPos(); llMoveToTarget(startPos + <5,0,0>, 3.0);//first target } collision_start(integer n) {//I placed a prim in the path of the first target llOwnerSay("I have collided with something"); testTarget = llTarget(startPos + <0,5,0>, 0.1);//second target with no obstruction llMoveToTarget(startPos + <0,5,0>, 3.0); } at_target(integer targetInt, vector targetPos, vector currentPos) { if(llVecDist(startPos, llGetPos()) <= 0.2){//at the third target/home postion llTargetRemove(startTarget); llSetStatus(STATUS_PHYSICS, FALSE); llOwnerSay("I am back at the start"); } else{//at the second target llOwnerSay("I am at the second target"); startTarget = llTarget(startPos,0.1);//third target llMoveToTarget(startPos,3.0); } } }
In both cases the collision event triggers the second llMoveToTarget.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|