Here's why it's complicated:
* Engine Type: You need to specify the engine in both the '87 Camaro and the '86 Trans Am. A small-block V8 (like a 305 or 350) is *more* likely to be adaptable than a larger V8, or a different engine type altogether.
* Mounts: Engine mounts are not necessarily interchangeable. Even if the engines are the same displacement, the positioning may be different, requiring modification or custom mounts.
* Wiring Harness and ECU: The wiring harnesses and Engine Control Units (ECUs) are likely different. Significant rewiring and possibly ECU adaptation will be needed.
* Exhaust System: The exhaust manifolds and system will likely need modification or replacement.
* Accessories: Power steering, alternator, and other accessories might not line up perfectly.
In short: While the possibility exists, especially with similar small-block V8s, this is not a simple swap. It requires significant mechanical knowledge, fabrication skills, and likely custom parts. It's far more likely to require extensive modification than a simple drop-in. A professional mechanic specializing in classic muscle cars would be the best person to assess the feasibility and cost.