antfarmar / Unity-3D-Asteroids

A simple Asteroids clone. In 3D.
The Unlicense
65 stars 15 forks source link

Particles no longer smear over screen when crossing edge #16

Closed ghost closed 8 years ago

ghost commented 8 years ago

The problem was that the particle system on the Ship prefab emit particles when it detects movement. Unfortunately screen wrapping confuse the particle system into emitting lots of particles which smeared across the entire screen.

My solution was to put a script on the particle system that listens for screen wraps and disables emission for one frame.

antfarmar commented 8 years ago

I've become so used to it that I've considered the smear a feature. :smirk:

The original way I had quickly implemented it was to deactivate the game object when wrapping (overkill) right in the ScreenWrap() method, but individual Components could be disabled there as well.

ghost commented 8 years ago

Yes, I saw that you set active to false and it's a solution.

However, that disabled the entire trail which looked a bit iffy. It looked very undesirable.

This solution keep the trail prior to the wrap. What's missing is a script to manage access to the particle system if multiple scripts need to use it.