Ball collision time with ceiling











up vote
0
down vote

favorite












I know to to do collision time with the ground.
Here's how I calculate that: gravityY = positive 9.81



float timeToGround = (velocity.y + Sqrt(velocity.y*velocity.y + 2f * gravityY * distanceToGround)) / gravityY;


How do I calculate the collision time to the roof/ceiling based on distance and initial velocity?



float timeToRoof = ?


I don't know where to look, thanks so much for your help










share|improve this question









New contributor




Sami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Hi there, welcome to SO. I think your question needs a bit of clarification: is gravityY maintained as a vector? (i.e. if it is +9.81 when falling to the ground, will it be -9.81 when rising to the roof?) What is velocity? Is it the initial/final velocity?
    – John Law
    Nov 8 at 8:52










  • gravity is constant, -9.81, just flipped - for simplicity. velocity is the current velocity
    – Sami
    Nov 8 at 10:49

















up vote
0
down vote

favorite












I know to to do collision time with the ground.
Here's how I calculate that: gravityY = positive 9.81



float timeToGround = (velocity.y + Sqrt(velocity.y*velocity.y + 2f * gravityY * distanceToGround)) / gravityY;


How do I calculate the collision time to the roof/ceiling based on distance and initial velocity?



float timeToRoof = ?


I don't know where to look, thanks so much for your help










share|improve this question









New contributor




Sami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Hi there, welcome to SO. I think your question needs a bit of clarification: is gravityY maintained as a vector? (i.e. if it is +9.81 when falling to the ground, will it be -9.81 when rising to the roof?) What is velocity? Is it the initial/final velocity?
    – John Law
    Nov 8 at 8:52










  • gravity is constant, -9.81, just flipped - for simplicity. velocity is the current velocity
    – Sami
    Nov 8 at 10:49















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I know to to do collision time with the ground.
Here's how I calculate that: gravityY = positive 9.81



float timeToGround = (velocity.y + Sqrt(velocity.y*velocity.y + 2f * gravityY * distanceToGround)) / gravityY;


How do I calculate the collision time to the roof/ceiling based on distance and initial velocity?



float timeToRoof = ?


I don't know where to look, thanks so much for your help










share|improve this question









New contributor




Sami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I know to to do collision time with the ground.
Here's how I calculate that: gravityY = positive 9.81



float timeToGround = (velocity.y + Sqrt(velocity.y*velocity.y + 2f * gravityY * distanceToGround)) / gravityY;


How do I calculate the collision time to the roof/ceiling based on distance and initial velocity?



float timeToRoof = ?


I don't know where to look, thanks so much for your help







math collision gravity






share|improve this question









New contributor




Sami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Sami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Nov 8 at 8:50









f_puras

2,18342231




2,18342231






New contributor




Sami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 8 at 8:31









Sami

32




32




New contributor




Sami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Sami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Sami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Hi there, welcome to SO. I think your question needs a bit of clarification: is gravityY maintained as a vector? (i.e. if it is +9.81 when falling to the ground, will it be -9.81 when rising to the roof?) What is velocity? Is it the initial/final velocity?
    – John Law
    Nov 8 at 8:52










  • gravity is constant, -9.81, just flipped - for simplicity. velocity is the current velocity
    – Sami
    Nov 8 at 10:49




















  • Hi there, welcome to SO. I think your question needs a bit of clarification: is gravityY maintained as a vector? (i.e. if it is +9.81 when falling to the ground, will it be -9.81 when rising to the roof?) What is velocity? Is it the initial/final velocity?
    – John Law
    Nov 8 at 8:52










  • gravity is constant, -9.81, just flipped - for simplicity. velocity is the current velocity
    – Sami
    Nov 8 at 10:49


















Hi there, welcome to SO. I think your question needs a bit of clarification: is gravityY maintained as a vector? (i.e. if it is +9.81 when falling to the ground, will it be -9.81 when rising to the roof?) What is velocity? Is it the initial/final velocity?
– John Law
Nov 8 at 8:52




Hi there, welcome to SO. I think your question needs a bit of clarification: is gravityY maintained as a vector? (i.e. if it is +9.81 when falling to the ground, will it be -9.81 when rising to the roof?) What is velocity? Is it the initial/final velocity?
– John Law
Nov 8 at 8:52












gravity is constant, -9.81, just flipped - for simplicity. velocity is the current velocity
– Sami
Nov 8 at 10:49






gravity is constant, -9.81, just flipped - for simplicity. velocity is the current velocity
– Sami
Nov 8 at 10:49














2 Answers
2






active

oldest

votes

















up vote
0
down vote



accepted










You need to solve quadratic equation for unknown time t



h = y0 + Vy * t  - g*t^2 / 2
or
g*t^2/2 - Vy*t + (h-y0) = 0 // a,b,c coefficient grouped


for known height of starting point y0, roof height h, gravity g, y-component of initial velocity Vy






share|improve this answer





















  • wait, isn't this the exact same equation that i provided? am i missing something?
    – Sami
    Nov 8 at 11:22












  • Yes, your formula represents solution of this equation for case h=0, y0 = distanceToGround. You can slightly correct it for you current task (that has not been properly formulated yet)
    – MBo
    Nov 8 at 11:37










  • It's the same suvat formula, the same general principle; but you substitute in g = -9.81 (negative acceleration, instead of positive) and h - y0 = distanceToRoof, so it's still different in some respects.
    – John Law
    Nov 8 at 17:27


















up vote
0
down vote













Hehe, thanks for your help.
Here's the answer:



float timeToRoof = (-velocity.y + Sqrt(velocity.y * velocity.y + 2f * gravity.y * distanceToRoof)) / gravity.y;



  • gravity.y = negative -9.81

  • velocity.y = current velocity

  • distanceToRoof = current distance to roof






share|improve this answer








New contributor




Sami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });






    Sami is a new contributor. Be nice, and check out our Code of Conduct.










     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203956%2fball-collision-time-with-ceiling%23new-answer', 'question_page');
    }
    );

    Post as a guest
































    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote



    accepted










    You need to solve quadratic equation for unknown time t



    h = y0 + Vy * t  - g*t^2 / 2
    or
    g*t^2/2 - Vy*t + (h-y0) = 0 // a,b,c coefficient grouped


    for known height of starting point y0, roof height h, gravity g, y-component of initial velocity Vy






    share|improve this answer





















    • wait, isn't this the exact same equation that i provided? am i missing something?
      – Sami
      Nov 8 at 11:22












    • Yes, your formula represents solution of this equation for case h=0, y0 = distanceToGround. You can slightly correct it for you current task (that has not been properly formulated yet)
      – MBo
      Nov 8 at 11:37










    • It's the same suvat formula, the same general principle; but you substitute in g = -9.81 (negative acceleration, instead of positive) and h - y0 = distanceToRoof, so it's still different in some respects.
      – John Law
      Nov 8 at 17:27















    up vote
    0
    down vote



    accepted










    You need to solve quadratic equation for unknown time t



    h = y0 + Vy * t  - g*t^2 / 2
    or
    g*t^2/2 - Vy*t + (h-y0) = 0 // a,b,c coefficient grouped


    for known height of starting point y0, roof height h, gravity g, y-component of initial velocity Vy






    share|improve this answer





















    • wait, isn't this the exact same equation that i provided? am i missing something?
      – Sami
      Nov 8 at 11:22












    • Yes, your formula represents solution of this equation for case h=0, y0 = distanceToGround. You can slightly correct it for you current task (that has not been properly formulated yet)
      – MBo
      Nov 8 at 11:37










    • It's the same suvat formula, the same general principle; but you substitute in g = -9.81 (negative acceleration, instead of positive) and h - y0 = distanceToRoof, so it's still different in some respects.
      – John Law
      Nov 8 at 17:27













    up vote
    0
    down vote



    accepted







    up vote
    0
    down vote



    accepted






    You need to solve quadratic equation for unknown time t



    h = y0 + Vy * t  - g*t^2 / 2
    or
    g*t^2/2 - Vy*t + (h-y0) = 0 // a,b,c coefficient grouped


    for known height of starting point y0, roof height h, gravity g, y-component of initial velocity Vy






    share|improve this answer












    You need to solve quadratic equation for unknown time t



    h = y0 + Vy * t  - g*t^2 / 2
    or
    g*t^2/2 - Vy*t + (h-y0) = 0 // a,b,c coefficient grouped


    for known height of starting point y0, roof height h, gravity g, y-component of initial velocity Vy







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 8 at 8:54









    MBo

    44.7k22847




    44.7k22847












    • wait, isn't this the exact same equation that i provided? am i missing something?
      – Sami
      Nov 8 at 11:22












    • Yes, your formula represents solution of this equation for case h=0, y0 = distanceToGround. You can slightly correct it for you current task (that has not been properly formulated yet)
      – MBo
      Nov 8 at 11:37










    • It's the same suvat formula, the same general principle; but you substitute in g = -9.81 (negative acceleration, instead of positive) and h - y0 = distanceToRoof, so it's still different in some respects.
      – John Law
      Nov 8 at 17:27


















    • wait, isn't this the exact same equation that i provided? am i missing something?
      – Sami
      Nov 8 at 11:22












    • Yes, your formula represents solution of this equation for case h=0, y0 = distanceToGround. You can slightly correct it for you current task (that has not been properly formulated yet)
      – MBo
      Nov 8 at 11:37










    • It's the same suvat formula, the same general principle; but you substitute in g = -9.81 (negative acceleration, instead of positive) and h - y0 = distanceToRoof, so it's still different in some respects.
      – John Law
      Nov 8 at 17:27
















    wait, isn't this the exact same equation that i provided? am i missing something?
    – Sami
    Nov 8 at 11:22






    wait, isn't this the exact same equation that i provided? am i missing something?
    – Sami
    Nov 8 at 11:22














    Yes, your formula represents solution of this equation for case h=0, y0 = distanceToGround. You can slightly correct it for you current task (that has not been properly formulated yet)
    – MBo
    Nov 8 at 11:37




    Yes, your formula represents solution of this equation for case h=0, y0 = distanceToGround. You can slightly correct it for you current task (that has not been properly formulated yet)
    – MBo
    Nov 8 at 11:37












    It's the same suvat formula, the same general principle; but you substitute in g = -9.81 (negative acceleration, instead of positive) and h - y0 = distanceToRoof, so it's still different in some respects.
    – John Law
    Nov 8 at 17:27




    It's the same suvat formula, the same general principle; but you substitute in g = -9.81 (negative acceleration, instead of positive) and h - y0 = distanceToRoof, so it's still different in some respects.
    – John Law
    Nov 8 at 17:27












    up vote
    0
    down vote













    Hehe, thanks for your help.
    Here's the answer:



    float timeToRoof = (-velocity.y + Sqrt(velocity.y * velocity.y + 2f * gravity.y * distanceToRoof)) / gravity.y;



    • gravity.y = negative -9.81

    • velocity.y = current velocity

    • distanceToRoof = current distance to roof






    share|improve this answer








    New contributor




    Sami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      0
      down vote













      Hehe, thanks for your help.
      Here's the answer:



      float timeToRoof = (-velocity.y + Sqrt(velocity.y * velocity.y + 2f * gravity.y * distanceToRoof)) / gravity.y;



      • gravity.y = negative -9.81

      • velocity.y = current velocity

      • distanceToRoof = current distance to roof






      share|improve this answer








      New contributor




      Sami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















        up vote
        0
        down vote










        up vote
        0
        down vote









        Hehe, thanks for your help.
        Here's the answer:



        float timeToRoof = (-velocity.y + Sqrt(velocity.y * velocity.y + 2f * gravity.y * distanceToRoof)) / gravity.y;



        • gravity.y = negative -9.81

        • velocity.y = current velocity

        • distanceToRoof = current distance to roof






        share|improve this answer








        New contributor




        Sami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        Hehe, thanks for your help.
        Here's the answer:



        float timeToRoof = (-velocity.y + Sqrt(velocity.y * velocity.y + 2f * gravity.y * distanceToRoof)) / gravity.y;



        • gravity.y = negative -9.81

        • velocity.y = current velocity

        • distanceToRoof = current distance to roof







        share|improve this answer








        New contributor




        Sami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        Sami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered 2 days ago









        Sami

        32




        32




        New contributor




        Sami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        Sami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        Sami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






















            Sami is a new contributor. Be nice, and check out our Code of Conduct.










             

            draft saved


            draft discarded


















            Sami is a new contributor. Be nice, and check out our Code of Conduct.













            Sami is a new contributor. Be nice, and check out our Code of Conduct.












            Sami is a new contributor. Be nice, and check out our Code of Conduct.















             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203956%2fball-collision-time-with-ceiling%23new-answer', 'question_page');
            }
            );

            Post as a guest




















































































            Popular posts from this blog

            Schultheiß

            Liste der Kulturdenkmale in Wilsdruff

            Android Play Services Check