Hi Dino,
Hope you're well. Thanks for points me in the right direction with the lasers, I now have red lasers zapping out of my spaceship at the correct worldspace, and they look exactly how I wanted (well, nearly).
However, I have reached a result whilst missing out (due to confusion) one or two steps from your instructions, which niggles me because I'm sure you have best-practice coding in mind, so I'd like to really nail what you instructed and refine what I've done.
The areas that confused me are:
Best is to use a global transition (call it 'Set Laser' for example) to do the set positions and draw line.
The Start state should be empty - I have set a global transition, but not sure how to implement it.
When you Create the Prefab, store it in a variable. - I have done this, but not sure what to do with it.
Then use a 'Send Event By Name' and also target the Prefab and send the 'Set Laser' - Just general confusion.
At the moment, my set up is this:
I have a spaceship, with an empty GameObject positioned at the tip of the laser cannon. This GameObject is called Laser1.
On Laser1 I have an FSM:
> Start
> State 1 - Get Key Down - M. When M is pressed go to state 2.
> State 2 - (screen grabs below).
I have a simple third state for the Hit Event in the RayCast, but it's empty and not important at this stage.
Okay. Next I have the Prefab.
As you suggested, I made one GameObject as the Parent, and 2 Children inside: startpoint and endpoint.
On the Parent I have one FSM, called FIRE:
This Parent object was then dragged down into my Prefabs folder, to create the Prefab. This Prefab is renamed to Laser2.
I deleted the original in the hierarchy window, then dragged the Prefab up to take it's place.
On the whole, this entire set-up has moved me in the direction I desire, with loads of lasers shooting out, all in the correct place.
I have yet to work out the Pooling technique which will be essential I guess, as the Hierarchy window fills up very quickly with clones prefabs.
Anyway... so back to your instructions... Like I said, I kinda have it working, but feel like I'm going to get a slap round the face at one point if I don't get your technique correct. Please could you help me some more?
Thank you SO much for the assistance you've given, I'm really happy with what you've helped me achieve.