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.

How can I get the height of different blocks?

Discussion in 'Programming Questions and Suggestions' started by Kezeslabas, Aug 9, 2019.

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

    Messages:
    6
    I would need the height of pistons for a script, to control rotating arms made out of pistons of different types, like modded pistons and such.

    I want to adjust the rotation speed automatically and I need this information to do that.
    It's easy to get that how much a piston is extended, but I'm struggling to figure out how to get the base height of the individual pistons.

    Anyone can help?
     
  2. mojomann71 Senior Engineer

    Messages:
    1,669
    One large block = 2.5M. I am currently at work and I think a large piston is 2 blocks in length so that would be 5M (not extended of course). If it is 3 blocks in length then, of course, it would be 7.5M (not extended).

    Small Block is 0.5M a block. Same rule applies as above to figure out the length of a non-extended piston.

    I am assuming that is what you were looking for??
     
  3. Kezeslabas Trainee Engineer

    Messages:
    6
    No, I know this, what I'm looking for is to how get this information trough programming.

    Like let's say that there are random pistons with different heights, placed on top of each other, and I want to know, how tall that Piston tower is, without counting it with my eyes.
    Like is there a way to get their individual heights in a script without manual input?
     
  4. Mollymawk Trainee Engineer

    Messages:
    94
    Two ideas:
    GetPosition() of a block at the top and another at the bottom then calc the distance. control panels are very small and hopefully would not impact the design of the machine.

    Vector3D.DistanceSquared(Vector3D, Vector3D) is quicker than Vector3D.Distance(Vector3D, Vector3D) if you using it many times in a loop.

    Also Camera looking up or down could work. but if things are rotating and stretching all over the place getting it to point in the right direction could be an issue.

    if the pistons are all in line though, and are the only things affecting height. i would use the pistons CurrentPosition and MaxPosition
     
    Last edited: Aug 19, 2019
Thread Status:
This last post in this thread was made more than 31 days old.