Check out this great DIY that shows you how to make a DIY webcam-based laser distance finder. This is great for implementing distance-sensing projects along with a live webcam.
The author also included some Visual Basic code you can use to implement on a Windows-based program. I am sure you can easily hack the code to use elsewhere with other projects out there.
Miniature robotic rotorcraft for example can carry about 100g of payload. It is possible to perform machine vision tasks such as obstacle identification and avoidance though the use of a webcam (or mini wireless camera interfaced to a computer via USB adaptor). Better yet, two webcams can provide stereo machine vision thus improving obstacle avoidance because depth can be determined. The drawback of this of course is the addition of the weight of a second camera. This page describes how a mini laser pointer can be configured along with a single camera to provide mono-machine vision with range information.