Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

Getting the Vector where the Player is looking at...

Discussion in 'Programming Questions and Suggestions' started by DJToxica, Jan 30, 2017.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. DJToxica Apprentice Engineer

    Messages:
    129
    Is it possible to somehow read the vector of where the player is looking at with the ALT-Button?
    I want to create a fully player controlled Dreadnought for some interesting battles. Which means i want to control a group of turrets without leaving the pilot seat or switch to a turret (thats what i have at the moment, all turrets synchronize to one but its nearly impossible to manuever that way)
    Auto Targeting Turrets are lame and it is pretty easy to hit targets that way...so that was my idea....any suggestions maybe with digis control module?
     
  2. Sinbad Senior Engineer

    Messages:
    2,788
    Digi's can sample the mouse input, which in theory would also track your view aiming. In practice they eventually get out of sync.
    But, digi's cm also allows for key combinations, so you could set it up to only sample mouse movements when alt (or any other key) is held. When its released, have the script return the turrets to the cockpit crosshair. That way you have a way to realign view aiming with turret aim.
     
  3. Wicorel Senior Engineer

    Messages:
    1,242
    Added ModAPI has:
    VRage.Game.ModAPI.IMyCharacter AimedPoint get/set Get aimed direction (set for bots)

    But that's Mod only.
     
  4. DJToxica Apprentice Engineer

    Messages:
    129
    @Wicorel soo if i understand that right, thats not a function i can call normally from ingame PB right? I have to make a mod which parses the variable to an ingame global variable or sth like that?
    Sorry for asking this nooblike questions. My programming skills are not that bad i just startet playing around a bit with space engineers.
    Digi's input mod can do wonders but that turret mod i have e.g., has some really slow moving turrets. So if i yank the mouse around it gets totally out of sync.
     
  5. plaYer2k Master Engineer

    Messages:
    3,160
    I wish too that each IMyCharacter would expose the view matrix. After all some facial recognition and eye tracking aint so uncommon nowadays.

    Another approach that works ingame is using the IMyShipController.[Move|Rotation|Roll]Indicator (Vector3, Vector2, float). With that you can get the mapped WASD+Space+C (Move), Mouse (Rotation) and Q+E (Roll) inputs.

    With that in mind, you could get a different setup running ingame.
     
    • Agree Agree x 1
  6. Wicorel Senior Engineer

    Messages:
    1,242
    Correct, you cannot access it from ingame scripts.

    You could make a mod, but then you might as well do what you want in the mod.
     
Thread Status:
This last post in this thread was made more than 31 days old.