Home   Help Search Login Register  

Author Topic: Find the angle of CoC arty  (Read 881 times)

0 Members and 1 Guest are viewing this topic.

Offline Garcia

  • Members
  • *
  • Leeds United is the best football team...EVER!
Find the angle of CoC arty
« on: 05 Jul 2005, 03:11:29 »
Errrm, is it possible to find the angle of the CoC mortars just after they've fired. The angle being the angle of the barrel, not the direction of the cannon.

UNN

  • Guest
Re:Find the angle of CoC arty
« Reply #1 on: 05 Jul 2005, 11:06:34 »
There is probably a function with CoC's UA to return that? But you can always try this.

Add this the the lead Mortars init:

Code: [Select]
This AddEventHandler ["Fired",{_Shell=NearestObject [_This Select 0,_This Select 4] ; [_This Select 0,_Shell] Exec {Script.sqs}}]"
Script.sqs:
Code: [Select]
_Vehicle=_This Select 0
_Shell=_This Select 1

Hint Format ["Shell %1",Velocity _Shell]

Sorry I can't remember the Trigonemtry off hand, thats required to calculate the shells angle :( And if I did, it would be over the top. Perhaps someone else could add an efficent way of getting the shells pitch?

Edit:

Ok, I think it's this?

Script.sqs:
Code: [Select]
_Vehicle=_This Select 0
_Shell=_This Select 1

_Vel=Velocity _Shell

Hint Format ["Pitch %1",Sqrt(((_Vel Select 0)^2) + ((_Vel Select 1)^2)) Atan (_Vel Select 2)]
« Last Edit: 05 Jul 2005, 12:45:34 by UNN »

Offline Garcia

  • Members
  • *
  • Leeds United is the best football team...EVER!
Re:Find the angle of CoC arty
« Reply #2 on: 05 Jul 2005, 22:44:10 »
hmm, didn't work...first I got an error about the Atan, so I tried changing it to * atan, but then I got a very high pitch, tried changing it to /,- and +, but didn't get a pitch that seemed ok...and besides, OFP used to long to find it anyway :-\

Anyway, your script gave me and idea, which actually works perfect for what I need :-*

So, thank you ;)

UNN

  • Guest
Re:Find the angle of CoC arty
« Reply #3 on: 06 Jul 2005, 01:32:31 »
Yeah,

It should have been ATan2, and I got the parameters the wrong way round:

Code: [Select]
Hint Format ["Pitch %1",(_Vel Select 2) ATan2 Sqrt(((_Vel Select 0)^2) + ((_Vel Select 1)^2))]
Doh

Offline Garcia

  • Members
  • *
  • Leeds United is the best football team...EVER!
Re:Find the angle of CoC arty
« Reply #4 on: 06 Jul 2005, 01:43:35 »
heh, well, shit happens ;) I guess I can press that solved button now ;D