Guys,
I want to be able to know, in script, when a player is looking at a particular object. Specifically, when they are holding my upcoming IED detector device (a reconfigged and remodeled pistol) and when they are pointing at one of my hidden IEDs. It will beep at them, the closer they are when pointed at the IED, the faster the beeps.
I've scoured the biki and the comref and done a few early test, with disappointing results.
weaponDirection returns a vector, which I don't understand. I don't understand what data it's presenting to me, nor how it could be used. I don't understand what a vector is. I wonder if screenToWorld has anything to do with this?
aimPos seemed to have promise. The biki says it's the objects aiming position, but for a player holding a pistol, it simply returns the players pos. I was hoping it might return the pos of the aimed target.
aimedAtTarget didn't apparently do anything. It returned zero even when I aimed directly at the given target.
cursorTarget is the only thing that's given me any joy so far. It returns the object that I'm looking at. If I combine that with a check to see if the player has detector as main weapon in hand and is less than 10m from cursor target when cursor target = myIED then I can make an alarm noise for the player. At least, that's the theory. I worry about the biki references to knowsAbout from cursorTarget. The whole idea of my IED system is that they are completely or partially hidden from view by clutter objects and so the player may not knowabout the IED.
Are there any other commands or functions that might be of use to me?
If weaponDirection is the way forward for me, can it be explained to me in quite small words? :)
Any other comments and help gratefully received.