Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Wall collision rotation

  1. Oct 29, 2009 #1

    MTK

    User Avatar

    I implemented collisions with walls in my Java physics engine, complete with elasticity and friction, but I am not sure how to calculate the post-collision rotation. Maybe you can help?

    Here is the wall collision method (if you can understand it) :

    Code (Text):

    public void processWallCollision(Vector normal) {
            Vector wall = normal.rotate(Math.PI/2);
            Vector normalProjection = velocity.projectOnto(normal);
            Vector wallProjection = velocity.projectOnto(wall);
            normalProjection = normalProjection.reverse();
            normalProjection = normalProjection.scale(elasticity);
            wallProjection = wallProjection.scale(1-friction);
            velocity = normalProjection.add(wallProjection);
    }
     
     
  2. jcsd
  3. Oct 30, 2009 #2

    MTK

    User Avatar

    I am thinking that it might actually be best to have am impulse function (similar to the apply force function), that would set the velocity of a certrain point (instead of increasing or decreasing it) in the object to a specified value, and calculating the velocity ant rotation from that.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Wall collision rotation
  1. On collisions (Replies: 0)

Loading...