Home   Help Search Login Register  

Author Topic: 3D Directions  (Read 599 times)

0 Members and 1 Guest are viewing this topic.

StonedSoldier

  • Guest
3D Directions
« on: 02 Dec 2004, 19:42:46 »
since the commands direction and setdir only works in 2 dimensions is there a way of detecting a units 3D direction??

bored_onion

  • Guest
Re:3D Directions
« Reply #1 on: 02 Dec 2004, 20:03:42 »
see the function library. it has a few on pitch  and yaw as well I think.

sa8gecko

  • Guest
Re:3D Directions
« Reply #2 on: 02 Dec 2004, 20:07:44 »
velocity and setVelocity?

But if the unit doesn't move, I think you're out of luck.
At least if you don't have a specially modified model: for example,
you would like to know where the gun of a tank is pointing.
If you set up your p3d model with two cargo proxies on the gun
itself, one near the turret and one near the muzzle (for example),
then filling the two cargo spaces with gamelogics you can find,
interrogating the GL positions you can obtain the a 3d vector
pointing at the same direction of the gun.
It would be interesting to know of alternative ways to do this.
For example, when you 'drop' a particle, this at the end of its life
can be made to execute a script. The argument passed to the script
is the position of the particle at the moment it 'dies'. Since you can
drop particles even on model selection (i.e.'konec hlavne', 'zamreny'
and the like, even for selection in resolution lods) this could give you
the 3D direction, confronting the position passed to the script with the
unit's one. But unfortunately it seems that even if you drop the particle
on the muzzle of the gun, the particle is created in the position the
gun would be as if would be fixed as displayed in O2, rotating with the
hull, but not elevating or rotating with the turret.


EDIT:
yes, they are the DsSchulle functions, that works on the principle
of dropping particles. But they work well with vehicles without
turrets, like planes, choppers, boat and cars. So if you want to
know where the turret's gun is pointing, they can't help you.
Mind, I'd really like someone could disprove this, cause it would
be a great step forward.
« Last Edit: 02 Dec 2004, 20:15:48 by sa8gecko »

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:3D Directions
« Reply #3 on: 02 Dec 2004, 20:37:19 »
The problem is that you get error messages when trying to download dschulles functions. I've posted this in the OFPEC Site Problems/Bugs thread ages ago but no reply.

:beat: *Gets Shot* :beat:

Offline MachoMan

  • Honoured
  • Former Staff
  • ****
  • KISS, Keep it Simple Stupid
Re:3D Directions
« Reply #4 on: 02 Dec 2004, 20:52:47 »
Well I may know a work-around:

step 1: Use direction to determine which way a unit is facing.

step 2: Find an object the player can see.

step 3: a = position object
           b = position player

step 4: direction = [a.x - b.x, a.y - b.y, a.z - b.z]

now if for you would like to know the yawn ....
n = [0,1,0], this is vector pointing dead ahead.

step 5: now take the dot-product of those two. (n & direction)
And voila you have the cosinus of the angle.

It's a longshot, and probably very inaccurate, but I've tried cracking it this way, but it isn't very functional yet, so please have a go at it.
Get those missions out there you morons!