Home   Help Search Login Register  

Author Topic: Making Laser Target Viewable  (Read 905 times)

0 Members and 1 Guest are viewing this topic.

Offline Arctic

  • Members
  • *
  • In Utero
Making Laser Target Viewable
« on: 04 Oct 2002, 01:47:12 »
This has to do with the FAC script which I am working on. need the Laser Dot to get out of the armour units.

The dot gets put in the middle of the vehicles so I can't see it. This is because I use the CamCreate command and tell it to go to [0,0,1] in the target. The problem is, I can't see the dot!

Is there a way that I can make the dot always appear in front of the vehicle, facing the player? I am trying [((_lposx) + (Random 2), (lposy) + (Random 2), (_lposZ) + (1)]  

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:Making Laser Target Viewable
« Reply #1 on: 04 Oct 2002, 21:41:13 »
Ugh.  Well, that will require some work.
First, determine the height ASL of the player and the target
A. set up a trigger and call it ASL.  It doens't ever have to activate
B. this bit of code:
offset = 3
;3 meters closer
ASL setpos [getpos player select 0, getpos player select 1]
PlayerASL = (getpos player select 2) + (-1 *(getpos player select 2))
_targetbearing = ((getpos MyTarget select 0) - (getpos player select 0)) / ((getpos MyTarget select 1) - (getpos player select 1))
_targetelevation = (sqrt((((getpos MyTarget select 0) - (getpos player select 0))^2) + (((getpos MyTarget select 1) - (getpos player select 1))^2)))/(player distance MyTarget)
;you might have to invert one or both of these to get it to come out the right end
_newzoffset = ((player distance mytarget)-offset) * (_targetelevation)
_newdistance = ((player distance mytarget)-offset) * (sqrt(1-(_targetelevation^2)))
_newxoffset = (_newdistance * _targetbearing)
_newYoffset = (_newdistance * (1/_targetbearing))
_newXY = [(getpos player select 0) + _newxoffset, (getpos player select 1) + _newYoffset]
ASL setpos _newXY
LaserTarget = "LaserTarget" createvehicle (_newxy + [PlayerASL + (getpos player select 2) + _newzoffset) + (getpos ASL select 2)])


Anyway, that should do it.  I'm sure it's ful of bugs, but you can find and clear them.
and remember, you can only see the LT in cadet mode.
Dinger/Cfit