Jump to content

Aim detection


Lash Carver
 Share

You are about to reply to a thread that has been inactive for 3538 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Can anybody point me in the right direction (no pun intended) for finding how people are able to show what DIRECTION somebody is aiming at them from?  So to be clear, I need some kind of indicator that points to the nearest person who happens to be aiming at me.

 

I found a script to tell me who is aiming at me but how do I know what direction they are in? I looked into llLookAt which seems to act similar to what I need but seems somehow... off. I know I've seen huds which show perfectly, just not sure if it's some complicated calculation or something i'm missing. 

 

Thanks in advance!

Link to comment
Share on other sites

You're not likely to be able to do that.  At least not reliably.  Most targeting weapons these days use llCastRay, which is undetectable unless the weapon and whatever target you wear are scripted to tell you who shot whom.  It's not like an active sonar or radar ping, so it doesn't "hit" a target and leave some sort of trace.  If it serves as the setup for a physical projectile, you could detect that and work back its trajectory if you were really lucky.

Link to comment
Share on other sites

Thanks for the info. I have two guns that have this in the ammo hud. It's a big invisible circle with a small arrow. It looks like the circle rotates in the direction of the person who is aiming at me. 

 

I am not trying to detect the llCastRay but more so using the llDetectedPos and llDetectedRot to figure it out somehow... 

Link to comment
Share on other sites

Yah, unfortunately llDetectedPos() and llDetectedRot() will only tell you what YOU detect.  You want to know who's detecting YOU.  The only way that a tool like the one you described is going to work is if it is set up to listen for the other person's pings.  So, for example, if you set up a shooting gallery you can use a cast ray from your gun to tell you when you have hit a target.  The target will only know that you have hit it if you immediately send a message that says, "Hey, TARGET!  I just hit you".  The target has to be prepared to listen for that specific message and roll over dead.

Now, you could combine that with a radar that identifies all people within range so that you know who the potential shooters are before they shoot.  Suppose that you are wearing a target -- like a paintball target -- that receives a "HIT!" message but only tells you WHO hit you.  The radar could then tell you where that person is.  That would be a fairly normal game setup.

Link to comment
Share on other sites

Kinda...

 

This is what I have sofar and the calculation still isn't quite correct...

sensor(integer num_detected){   string agentName = llDetectedName(0);   vector agentPosition = llDetectedPos(0);   rotation agentRotation = llDetectedRot(0);   vector ownPosition = llGetPos();   if (llGetAgentInfo(llDetectedKey(0)) & AGENT_MOUSELOOK)   {      if (m == FALSE)
{ float pos = llVecDist(ownPosition,agentPosition); if (llVecDist(ownPosition, agentPosition+llRot2Fwd(agentRotation)*pos) < 1.5) { name = agentName; dist = llRound(pos); } list MyRot = llGetObjectDetails(llGetOwner(),[OBJECT_ROT]); llLookAt(agentPosition*llList2Rot(MyRot,0),1,0); //his position times my rotation
}

 

So when somebody is aiming within 1.5 of me, it begins to rotate and attempt to point at them according to my current rotation.

Link to comment
Share on other sites

Yes, you have created a "MOM!  He's looking at me!" detector.  That's a nice start, but you could have several people looking at you, and the one that shot you is likely to be looking somewhere else by the time you detect him.  It would be most useful if the sensor were fired at the precise instant that you were hit, but even then it's likely to kick up false targets.  Still, a nice start.....

Link to comment
Share on other sites

this should follow the detcted person .... just use a sensor/timer etc ?

 

 

 

llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y , FALSE);       // rotate only around Z axis

MYpos = llGetPos();

PosTarget = llDetectedPos(0);
       llRotLookAt( llRotBetween( <0.0, 1.0, 0.0>, llVecNorm( <PosTarget.x, PosTarget.y, MYpos.z> - MYpos ) ), 1.0,   0.5 );

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3538 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...