- Home /
Rotate the textures in the particle system to direction of the particle system?
Well the problem is that I have created a texture in Photoshop that I use for my particle system. I use this particle system as my bullets. The thing is, the guns in my game rotate to look at the mouse. I need my textures to face the right way depending on the rotation. In the picture below, you can see my bullet texture is not facing the way my gun is. Is there some sorta solution to this? I have been working on this for 30 minutes now and no results :(
Answer by Owen-Reynolds · Sep 14, 2013 at 12:54 AM
In renderMode, at the bottom, set to "Stretched Billboard."
As you'd think, this stretches the particles, in the direction of motion. But it also rotates them to face the direction of movement.
You may have to set length scale to 1 (which means no stretch, but it will still aim.) If it aims the backside of the bullet, can try to fix by changing the Material Tiling x or y to -1. Think the only way to fix a bad 90 degree spin is to rotate the original texture.
Also works in the old "Legacy" particle system.
This solved something I've been struggling with for ages. $$anonymous$$y particle's 'rotation over lifetime' never looked correct from the opposite side: If you rotate a vertical bar 45 degree to its right, in real 3D you'll see its rotation 45 degree leftwards when looking back from behind it. However because the billboards' rotation follow the camera, with simple vertical billboards you'll see them rotated rightwards no matter from where you're looking at them! However, using streched billboards and ins$$anonymous$$d of setting 'rotation over lifetime', giving them 'velocity over lifetime' towards the rotations you want it to face, you can get those particles, due to them facing the velocity, to give a 3D rotation that looks consistent from all angles! Amazing how sometimes Unity hides superpowers behind names where you'd never expect them. 'stretched billboards' right? - when it's in fact a 'genius billboard' overco$$anonymous$$g the trickiest downside of billboards always facing the camera. Who'd have thought :)
It's frustrating limited though. You can't add rotational variety and scaling is from the base of the sprite, so shrinking a particle over time makes it appear to travel backwards. It's rather stupid to not have an alignment option in the particles and a pretty shocking oversight over the years Shuriken has been available.
$$anonymous$$ine just stopped displaying the sprite when I switched to stretched billboard
Your answer
Follow this Question
Related Questions
Making gun fire particle 2 Answers
Rotate child of FPS when camera moves on Y-axis 2 Answers
Troubles With A Shoot Script 1 Answer
Raycasting to the middle of the screen? 2 Answers