Motion detection is a boolean quantity -- motion has been detected or it has not.
I'd like to make my home automation more useful and predictive, by detecting motion in a specific direction (a vector). For example, with the floorplan below, if the motion is from the den towards the bedroom, the hallway and bedroom lights should turn on. If the motion is in the opposite direction, then the hallway and den lights should turn on.
Placing a motion detector at each end of the hallway, facing the other room, would enable some of this logic, but that's very sensitive to the exact location & coverage of the detector (ie., will it alert soon enough to turn on the hallway light, will there be enough distinction between multiple detectors to accurately determine direction, etc). In the mock floorplan, someone exiting the bathroom would likely trigger both hallway motion detectors, turning on both the Den and Bedroom lights.
I tried this at first with SmartThings and quickly gave up. I think you’re better off using many motion detectors. Otherwise you will run into problems with lights turning off when people are still in the room (and nothing makes my wife happier than that ). You could try hiding them. Mine are mostly along the white crown moldings, and out of site lines under kitchen cabinets. I try to have 3 detectors in rooms larger than a bathroom, and combine them in the zone motion controller app.
You could trigger on one motion detector and then use a wait on another motion detector and check the time between the triggers. If within a sensible time you could assume travel in that direction. I think it is probably not that difficult, but I've never had a need thus far to set this up in my environment.