Home   Help Search Login Register  

Author Topic: Vehicle reversing?  (Read 972 times)

0 Members and 1 Guest are viewing this topic.

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Vehicle reversing?
« on: 04 Feb 2005, 21:55:28 »
i was wondering if it would be possible to check the direction a vehicle is facing and then check if it was moving in the oposite direction to which it was facing, hence check if it was reversing?

mainly need it for a bit of larger scripting for some things im working on

cheers  :)
Proud Member of the Volunteer Commando Battalion

Offline MachoMan

  • Honoured
  • Former Staff
  • ****
  • KISS, Keep it Simple Stupid
Re:Vehicle reversing?
« Reply #1 on: 04 Feb 2005, 21:59:40 »
yes that would be possible ...  ;D
Get those missions out there you morons!

Offline RujiK

  • Members
  • *
  • KoKo Puh-Fizzles!
Re:Vehicle reversing?
« Reply #2 on: 04 Feb 2005, 22:16:08 »
Code: [Select]
?(speed VehicleName < 0):hint"Your going backwards!"
« Last Edit: 05 Feb 2005, 06:16:07 by RujiK »
I like your approach, lets see your departure.
Download the New Flashlight Script!

Offline MachoMan

  • Honoured
  • Former Staff
  • ****
  • KISS, Keep it Simple Stupid
Re:Vehicle reversing?
« Reply #3 on: 04 Feb 2005, 22:28:09 »
Ok I'll help out ;D

It's easy if you understand vectors, damn I should have payed more attention at school ;D

Ok to the point:

So we have sin & cos in ofp, we have heading, hey we have 3d Vecs wich give us heading and velocity, thats all we need!

As we all know the dir implementation of ofp is kinda simpel, 0 is North, 180 is south. Now we can combine those values to numbers using sin & cos.
Now im gonna get these things wrong, cause I always do:
(I think u can guess what veh means)
Code: [Select]
A = [sin getDir veh, cos getDir veh, 0]
B = getVelocity veh
//Make sure we can get valid results, since we cannot check vertical heading in ofp:
B = [B select 0, B select 1, 0]
Now we are gonna have to normalize B, to do that see here.

Now check
Code: [Select]
(A == -B) (which doesnt work in ofp, but I wont have to explain that I think.)
Et voila you a bool which tells you if you are reversing.
Get those missions out there you morons!

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Vehicle reversing?
« Reply #4 on: 04 Feb 2005, 22:56:49 »
...or you could do what rujik said...

 ;D

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Vehicle reversing?
« Reply #5 on: 04 Feb 2005, 23:10:02 »
If speed was 0 then the vehicle is stopped........so maybe:

?(speed VehicleName < 0):hint"Your going backwards!"

would be better.


Planck
I know a little about a lot, and a lot about a little.

Offline MachoMan

  • Honoured
  • Former Staff
  • ****
  • KISS, Keep it Simple Stupid
Re:Vehicle reversing?
« Reply #6 on: 04 Feb 2005, 23:52:39 »
Nah my way is better  ;D
« Last Edit: 04 Feb 2005, 23:53:06 by MachoMan »
Get those missions out there you morons!

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Vehicle reversing?
« Reply #7 on: 04 Feb 2005, 23:54:18 »
I imagine a variation would be:-

? (speed VehicleName = i) : hint "You're going sideways..."   ;D ::)
« Last Edit: 04 Feb 2005, 23:55:02 by macguba »
Plenty of reviewed ArmA missions for you to play

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Vehicle reversing?
« Reply #8 on: 05 Feb 2005, 00:24:29 »
Only in complex space I think ;D

Offline RujiK

  • Members
  • *
  • KoKo Puh-Fizzles!
Re:Vehicle reversing?
« Reply #9 on: 05 Feb 2005, 06:15:53 »
If speed was 0 then the vehicle is stopped........so maybe:

?(speed VehicleName < 0):hint"Your going backwards!"

would be better.


Planck

Oh, woops.
Ok post edited, thanks for noticing that.
I like your approach, lets see your departure.
Download the New Flashlight Script!

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:Vehicle reversing?
« Reply #10 on: 05 Feb 2005, 07:43:16 »
Negative speed is one of the most useful concepts in ofp. Makes life so much easier!  ;D

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Vehicle reversing?
« Reply #11 on: 05 Feb 2005, 19:59:31 »
ok... so negative speed works in ofp? awesome...

i'll try both ideas out and see how they work.

cheers  :)
Proud Member of the Volunteer Commando Battalion

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Vehicle reversing?
« Reply #12 on: 05 Feb 2005, 20:04:15 »
the negative speed one works excellenty... now to try and get it into an addon with an eventhandler.... always fun  :)

cheers guys
Proud Member of the Volunteer Commando Battalion