Bullet ricochet effect

So I have the gravity in the physics set to o. I have a ‘floor’ and a ‘ceiling’ and a left and right side, just thin lines to create an outline of the screen. And I’m firing a bullet image by using the touch drag method. The problem I can’t resolve is that the bullet doesn’t ricochet realistically. It hits a wall or ceiling or floor at an angle but ricochets either straight up or down, or straight left or right. I would think that , by the physics, that if the bullet hit a wall at an angle then it should bounce off at an angle. Do I need to calculate the angles manually? I found no results in my search of the forums but I would think that others would run into this seemingly basic idea. Please help.

Please post the function you’re using to “fire” your projectile, and we can then provide assistance.

function fireBullet(source, angle) 
      
      bullet = display.newImage(“bullet.png”)  
    bullet.myName=“bullet”
     bullet.x, bullet.y, bullet.rotation = source.x, source.y, angle
     physics.addBody( bullet, “dynamic”)
    
    bullet.isFixedRotation = true

    local direction = rotateTo( {x=5,y=0}, angle ) 
     bullet:applyForce( direction.x, direction.y, bullet.x, bullet.y )
      
    
    bullet:addEventListener( “collision”, bulletHit)
end

does this help?

function touch( e )
    local angle = angleBetweenPoints( ship, e )
    ship.rotation = angle+90 – because .rotation is not ‘east’
    print(‘angle’, angle)      
    if (e.phase == “began”) then   
      reticle =   display.newImage(“reticle.png”)
print(e.target)
      reticle.x = e.x   -13
      reticle.y = e.y
Runtime:addEventListener(“enterFrame”, reticle)

    elseif (e.phase == “moved”) then 
    reticle.x = e.x  -13
    reticle.y = e. y 
    else
       reticle:removeSelf()
        fireBullet(ship, angle)
    end
    return true
end

Runtime:addEventListener(“touch”,touch)

would this also help?

Please post the function you’re using to “fire” your projectile, and we can then provide assistance.

function fireBullet(source, angle) 
      
      bullet = display.newImage(“bullet.png”)  
    bullet.myName=“bullet”
     bullet.x, bullet.y, bullet.rotation = source.x, source.y, angle
     physics.addBody( bullet, “dynamic”)
    
    bullet.isFixedRotation = true

    local direction = rotateTo( {x=5,y=0}, angle ) 
     bullet:applyForce( direction.x, direction.y, bullet.x, bullet.y )
      
    
    bullet:addEventListener( “collision”, bulletHit)
end

does this help?

function touch( e )
    local angle = angleBetweenPoints( ship, e )
    ship.rotation = angle+90 – because .rotation is not ‘east’
    print(‘angle’, angle)      
    if (e.phase == “began”) then   
      reticle =   display.newImage(“reticle.png”)
print(e.target)
      reticle.x = e.x   -13
      reticle.y = e.y
Runtime:addEventListener(“enterFrame”, reticle)

    elseif (e.phase == “moved”) then 
    reticle.x = e.x  -13
    reticle.y = e. y 
    else
       reticle:removeSelf()
        fireBullet(ship, angle)
    end
    return true
end

Runtime:addEventListener(“touch”,touch)

would this also help?