I recently thought of making an enemy that fires an extending laser in front of it. I wanted the laser to start as a line from the center of the enemy, and extend forward from that center at any given angle until it reaches the wall. Immediately, Sine and Cosine seemed like the perfect functions to use for this given situation, and I decided to try using trigonometry to accurately push the endpoint of the line based on the facing angle of the enemy.
I tried applying this by creating a dummy example as shown below.
This works, but then caused my game's frame rate to drop into the abyss as several lines began to travel fairly far. Stencylpedia said to avoid trigonometry because it's "expensive", so is there any other way to do this? Trigonometry is the first thing that occurs to me when sketching out any problem that involves angles.
Edit: One of the things I want to be able to do with this is allow each enemy to slowly turn their individual lasers as shown below with the dummy actors