Jump to content
Sign in to follow this  
{USI}_Zombie

getdir and setdir work with facing but

Recommended Posts

getdir and setdir work with facing but is there a way to determine where a unit is aiming vertically? It seems getdir determines where you are looking, not where your feet are pointed; I can work with that. what I need to determine is where up or down a unit is looking and "force" a point there. dotarget doesn't seem to do it for players.

Does getdir and setdir have a z component or are they only 2d? I believe they only get and force a certain azimuth (2d). What I am working with is this:

_speed = [(_factor*(sin getDir _flyer))+(velocity _flyer select 0),(_factor*(cos getDir _flyer))+(velocity _flyer select 1),(velocity _flyer select 2)+.5];

_flyer SetVelocity _speed

which all works well but playtesting has determined that where a player is looking has an effect on the _speed variable. I can use setdir to take out some of the variability but looking up or down also changes where _flyer goes. Unless there are random air currents and viscositys that make _flyer go differently every time!

Share this post


Link to post
Share on other sites

Have you tried vectorDir? weaponDirection can also do the trick, it all depends on what you want to do with the script.

Share this post


Link to post
Share on other sites

the goal is to force a player to turn facing and look to a specified direction and 'pitch' so the setvelocity that occurs afterwards on the unit has a less random destination. Currently the destination can have variable forward and lateral distance traveled.

Share this post


Link to post
Share on other sites
Have you tried vectorDir? weaponDirection can also do the trick, it all depends on what you want to do with the script.

I can use weapondirection for troubleshooting. Since this script is called from an addaction I think it matters where you are looking when you call the action. Thanks for the input Celery, gave me something to work with. I really need to read ALL the comref, no telling what I will find there! :p

Share this post


Link to post
Share on other sites

I learned something. getdir and weapondirection return 2 different values. It seems the weapon points slightly to the right, even in ironsights. Was able to mod my script to account for that. Weapondirection even returns weapon pitch but I haven't found a way to "force" a value for it like I can for getdir/setdir.

Share this post


Link to post
Share on other sites

I still don't know the context for the script, but you could use vectorDir for x and y and weaponDirection for z.

Share this post


Link to post
Share on other sites

I dont think you can force a human player to aim his weapon. Cant really tell what your going for exactly so more info on your goal/idea is needed.

If it were me I would just tell the player to aim in desired direction and somehow not run the script untill it could be checked that they have complied.

Share this post


Link to post
Share on other sites
I still don't know the context for the script, but you could use vectorDir for x and y and weaponDirection for z.

hehe okay, you asked for it!

human cannonball, distance over 8km :p. the landing is variable up to and over 500m in distance based on (we think) where the player is looking (up/down) when the addaction is triggered. the lateral variable for the landing has been reduced in the latest version. we land in a similar 'line' to our destination.

Zombie was hoping to reduce the variable landing by forcing the player to face a certain direction, but just direction is not enough. A 'z' coordinate is also needed.

experimentation with a smaller object the addaction is triggered from, thus limiting the range one could be looking at when performing the action, did reduce the variable somewhat. but not enough to be satisfied.

further playtesting hints to zombie that part of his script where velocity is looped is part of the problem. when the velocity loop was disabled, the variable landing disappeared, we landed in the same spot, on top of each other almost. Distance traveled was a mere 700m, however.

whats the fun in that? ;)

Edited by [DirTyDeeDs]-Ziggy-

Share this post


Link to post
Share on other sites
I still don't know the context for the script, but you could use vectorDir for x and y and weaponDirection for z.

Fair enough, here is a mission with usage of the script. This is not the mission the final version of the concept will be used in. To call the action, look at the satellite dish and you should get the launch action. I challenge you to land in the same place twice. Experiment with your weapon aim, as well as the place/direction you are looking while flying. I can always land on the same "line" but the distance is always different.

launcher test

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×