1. This forum is obsolete and read-only. Feel free to contact us at support.keenswh.com

How to Get/Set Thruster Value

Discussion in 'Programming Questions and Suggestions' started by yokmp, Oct 3, 2015.

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

    yokmp Trainee Engineer

    Messages:
    40
    I want to get the thrust Value of a Thruster when i hit WASD to set the same thrust on another Thruster which is placed on top of a Rotor. Like a Master/Slave System ehere the Thruster ontop of the Rotor copies the behaviour of the Master Thruster.

    Can someone point me in the right direction or give examples?
     
  2. plaYer2k

    plaYer2k Master Engineer

    Messages:
    3,160
    There is no such thing as reading the WASD-controls yet sadly. There was a method that afaik used the power consumption to identify if a thruster was active and how strongly but that from afaik doesnt doesnt work anymore due to the removal of the IMyPowerProvider. Furthermore the inertial dampening and manual controls gave different thrust values for the same power output so you could have never been 100% certain which mode is active unless checking if ID has been disabled.

    What however works is reading the override thrust aswell as setting it. But still you lack the input.

    I made a pullrequest long ago exposing the IMYShipControllers translation and rotation vectors so we could do exactly that, read the joystick inputs from any cockpit etc to build our own interpreter. Though of course keen stopped merging anything til a week ago where they let only a single addition pass so far. So the source code community has to be largely considered dead as of right now, which is a real shame. Unless keen shows some love, we wont see any progress there.

    As alternative you could read WSAD-only with a clever setup of suspension wheels. Their forward-backward rotation represents WS and the steering AD.
    Howeer that is two dimensions out of six (3dim translation + 3dim rotation).
    So you do lack a whole lot, still.
     
  3. yokmp

    yokmp Trainee Engineer

    Messages:
    40
    I'm pretty shure you misread my post. I don't want to catch a keypress cause i know i can't do that within SE. I want the Slave Thruster to thrust when his Master one does it. So i press W, Master Thruster starts pushing me forward and the same time the skript then uses the override settings of the Slave Thruster.
    OR i could mesure my actual speed. when it increases then the SlaveThruster pushes me forward and when it decreases the thruster stopps ... is this possible? I KNOW i can measue my speed so i only had to activate the thrusteroverride.
     
  4. plaYer2k

    plaYer2k Master Engineer

    Messages:
    3,160
    I perfectly understood you there, though you might not understood the reason i gave you that example.

    We currently can not read the thrust values of thrusters.
    There merely was a method to read the power consumption but that is gone for now and we are waiting for a replacement.
    Though i previously said that already so that aint new.

    I was also pointing towards a possible future solution, if/once merged ofc, that would enable everyone to read the inputs (two Vector3 and nothing more) just like the game interprets it so you could directly drive the thrusters through your program.
    The reason behind that is that using thrusters as "sensors" to read the inputs based on their power consumptions is a rather convoluted and imo inferior method to something as simple as reading the values all the cockpits with their joysticks should make easily accessible anyway.

    You should also not try to simply use the velocity or acceleration as input because that is a rather error prone method too.
    Imagine a ship bumping into your ship. Your program would increase that bump and accelerate accordingly simply because you got knocked around.
    There simply are too many external sources that could influence your ship leading to erroneous behavior your cant control anymore.

    TL;DR
    Simply slaving thrusters dosnt work because you cant read the thrust values.
    Reading power consumption doesnt work anymore.
    Other alternatives are not available yet, or at least i know none and apparently nobody else reading this thread. (assuming you want full 3D movement and not just 2D in which case readinga suspension wheel would work)
     
  5. yokmp

    yokmp Trainee Engineer

    Messages:
    40
    So then I will stick to the Wheel-"Solution" for now. I only need one Thruster (forward). Is there an example out there?
     
  6. KalTauri

    KalTauri Trainee Engineer

    Messages:
    46
    You can get thruster override values and set them.
    Code:
    SetValueFloat("Override", 9460);
    
    this is roughly max(on a small ship small thruster), I forget exact max value, but you can pull property when it is set as max and broadcast it to find out.
    to get the value, I think it was GetValueFloat("Override");
     
Thread Status:
This last post in this thread was made more than 31 days old.