Feature Request: Direction Wheel for Apply Force



  • A few other objects have direction wheels.

    Apply Force has the multiplier, which seems ready to go with a direction.

    And I suck at calculating direction based on X and Y values and getting the vector right as a result.

    Plus it means more spaghetti.

    And a bonus... extra special request... direction of force switch that turns on following the rotation of the force's host. Kind of like how particles can be set to follow the rotation of their host.

    So, if you imagine Asteroids (the seminal game of 1980), you only need to turn the ship, any applied force is always going to occur in the right direction with this switch on.



  • @Deeeds You could try use propel object if you want an object to have a force applied in the direction its facing. You just have the object propel itself. Say, to propel upwards (when the object is rotated at zero), target A is the object with the y anchor changed to something like 45%, and target B is the same object with the anchor left default.



  • @Aidan-Oxley Not nearly the same.

    Not what I'm asking.

    Not the desired result.

    How does one calculate the force to be applied in any given direction?

    eg: direction = 243 degrees

    If zero degrees is up and north (I'm assuming that's how hyperPad does things... could be wrong, it might be up)

    And the force for 0 degrees is x= 0 and y= 100

    How does one rotate that force to 243 degrees?

    I do NOT know maths.



  • @Deeeds X force = diagonal force × cos(angle)
    Y force = diagonal force × sin(angle)
    This is assuming that 0° is to the right, 90° is up, 180° is left, 270° is down (conventional angles). But hyperPad angles don’t work like that. @Hamed do you think that the angle system could be changed a little to at least make anticlockwise positive? Just to make working with trig formulas easier?


  • Admin

    @Aidan-Oxley unfortunately this was a design choice early on. Does adding 90 degrees then multiplying by one not work?



  • @Aidan-Oxley Yes! I was already having trouble before realising up was 0. I'm also used to 0 being right. Most of the time. I think. Or something like that.

    So how do you calculate in this space?



  • @Hamed It’s fine, it’s still possible to do everything, just needs some more maths. How come you chose clockwise as positive though? To work completely with physics formulas, I have to reverse the direction and then add or subtract by 90° (I keep forgetting exactly how I do this, but I have done it).



  • @Deeeds You can get it to work by having 90 - object angle. Everything will work fine even though the numbers you get might look completely wrong. Getting the angle values to actually look right as text isn’t that easy.



  • @Aidan-Oxley Sorry, talk to me like I don't know what you're talking about.

    Step through the process, please. I really don't know what you mean.

    Where do I do the 90 reduction?



  • @Deeeds Add a Get Rotation behaviour and select your object. Add a Subtract Values behaviour, in the top part put in 90 and in the bottom part put in the output of Get Rotation. Now you can use this result instead of object rotation with the other formulas I said earlier to get an angled force 🙂



  • @Aidan-Oxley Cheers. I'll try. Math. My eyes glaze over and my hand reaches for a shot of whiskey every.single.time



  • @Deeeds MAAAAATHS!!! 😍😍😍😍 🤪



  • @Aidan-Oxley 👍🤣🤣



  • @Aidan-Oxley What is diagonal force?



  • @Aidan-Oxley I put in what I'd call the "desired parallel force" since it's the amount along any one axis that I like... and that worked. Which is 10, in my case.

    Does this mean that if you want something to move at 45 degrees at the same rate you'd like at one of the parallels, that you do this:

    X travel desired force: x=10, y=0
    Y travel desired force: x=0, y=10

    And therefore diagonal is x=10, y=10 ?

    I'd have thought it would be:

    x=5, y=5

    And that this would be called the diagonal force of x, and the diagonal force of y...

    Oh wait. I think I figured it out.

    Diagonal force is the combined force of X and Y to get the desired result???

    Right?

    I have no idea.



  • @Aidan-Oxley @Hamed

    THANK YOU BOTH!!

    This is now working. I have objects I can rotate and they apply force correctly.

    Feature request still stands! It would be awesome if this guff could be abstracted away to where it belongs, in the dustbin with the casio calculator watches of the 1980's.


Log in to reply
 

Looks like your connection to hyperPad Forum was lost, please wait while we try to reconnect.