ShadowRanger24 50 Posted April 12, 2017 So I'm trying to figure out a way to make a player face a given position. I thought setDir in combination with getRelDir would work but I can't get it to work. Any ideas? Thanks in advance. Share this post Link to post Share on other sites
tirpitz 15 Posted April 12, 2017 Please post codeSent from my D6503 using Tapatalk Share this post Link to post Share on other sites
ShadowRanger24 50 Posted April 12, 2017 11 minutes ago, tirpitz said: Please post code Sent from my D6503 using Tapatalk I'm a bit confused to how getRelDir works. I thought this would work, but it doesn't: player setDir ((player getRelDir _position) - 180); Share this post Link to post Share on other sites
tirpitz 15 Posted April 12, 2017 I'm a bit confused to how getRelDir works. I thought this would work, but it doesn't:player setDir ((player getRelDir _position) - 180); Have you tried?player setdir (player getreldir (getpos clanBase4)-180) Sent from my D6503 using Tapatalk Share this post Link to post Share on other sites
ShadowRanger24 50 Posted April 12, 2017 3 minutes ago, tirpitz said: Have you tried? player setdir (player getreldir (getpos clanBase4)-180) Sent from my D6503 using Tapatalk Just tried but doesn't work properly. It sets the player's direction to a different direction every time, and never to the actual position of the object. Share this post Link to post Share on other sites
tirpitz 15 Posted April 12, 2017 Have you tried different object types and checked that each component of the code returns am expected value For example that getpos returns the correct or expected value value ?I don't currently have arma on my laptop and I am on holiday with limited connectivity.Sent from my D6503 using Tapatalk Share this post Link to post Share on other sites
sarogahtyp 1109 Posted April 12, 2017 AFAIK: this should not be possible because of the possibility of cheating. You cant get control of players controls e.g. keys pressing or mouse moving. Share this post Link to post Share on other sites
MrCopyright 107 Posted April 12, 2017 @sarogahtyp, that has nothing to do with this. Using setDir does not "influence player controls". Share this post Link to post Share on other sites
sarogahtyp 1109 Posted April 12, 2017 2 minutes ago, MrCopyright said: @sarogahtyp, that has nothing to do with this. Using setDir does not "influence player controls". The direction is directly dependent to the crossfades position! So it has todo with it. Share this post Link to post Share on other sites
Greenfist 1863 Posted April 12, 2017 player setDir (player getDir _positionOrObject); And here's the description for getRelDir: https://community.bistudio.com/wiki/getRelDir Share this post Link to post Share on other sites
ShadowRanger24 50 Posted April 12, 2017 15 minutes ago, Greenfist said: player setDir (player getDir _positionOrObject); This will only set the player's direction to whatever the direction the object is. What I want is, to set the player to look at an objective. Basically I spawn them outside of an objective zone, and I want to make them face the center of the objective. Share this post Link to post Share on other sites
Greenfist 1863 Posted April 12, 2017 Oh you mean the eye direction, sorry. No, you can't control that directly. (Except with custom animations maybe) You could hide the player, create a camera at his eye position, turn it towards the target for couple of seconds, then back to the original direction, delete the camera, and return the player character. Share this post Link to post Share on other sites
mrcurry 511 Posted April 12, 2017 57 minutes ago, ShadowRanger24 said: This will only set the player's direction to whatever the direction the object is. What I want is, to set the player to look at an objective. Basically I spawn them outside of an objective zone, and I want to make them face the center of the objective. Wrong - Read the extended syntax of getDir When given 1 argument getDir returns the direction of the object. When given 2 arguments it will get the direction from the first argument to the second argument. //Dir from player to bottomleft corner of map: player getDir [0,0,0] //Dir from bottomleft corner of map to player: [0,0,0] getDir player Share this post Link to post Share on other sites
ShadowRanger24 50 Posted April 12, 2017 1 hour ago, mrcurry said: Wrong - Read the extended syntax of getDir When given 1 argument getDir returns the direction of the object. When given 2 arguments it will get the direction from the first argument to the second argument. //Dir from player to bottomleft corner of map: player getDir [0,0,0] //Dir from bottomleft corner of map to player: [0,0,0] getDir player This is exactly what I needed, surprised I didn't notice it. Thank you! And thanks to everyone else who was helping me. Share this post Link to post Share on other sites