Compare commits

..

10 Commits
2.3.0 ... mod

Author SHA1 Message Date
pth ad70ec6fd4 mm2 2023-08-17 18:23:06 +08:00
pth 820308adef mm 2023-08-17 18:00:02 +08:00
pth c145c2a87a remove samples 2023-08-17 17:53:53 +08:00
Simon (Darkside) Jackson 90fd22498f
Merge pull request #444 from solidsign/feature/UIParticleSystem_use_lengthScale
Add using lengthScale to UIParticleSystem
2023-07-22 16:11:13 +01:00
Simon (Darkside) Jackson 0dd1e6d7bb
Merge branch 'release' into feature/UIParticleSystem_use_lengthScale 2023-07-22 16:10:37 +01:00
Simon (Darkside) Jackson 0a424334e9
Merge pull request #443 from adibacco/patch-1
Update UILineRenderer.cs
2023-07-22 16:10:26 +01:00
eldar.zakaryaev 11de683781 Fix UIParticleSystem does not correspond to runtime lengthScale change 2023-07-05 11:24:50 +03:00
eldar.zakaryaev 2a925fcf65 Add using lengthScale to UIParticleSystem 2023-07-05 11:11:44 +03:00
adibacco 34e3f82395
Update UILineRenderer.cs
There is no need to draw either points or segments. Both should be drawn.
2023-06-28 23:00:16 +02:00
Simon Jackson d2b10980e3 Patch readme 2023-02-09 17:48:30 +00:00
7 changed files with 29 additions and 28 deletions

2
.gitignore vendored
View File

@ -33,3 +33,5 @@ sysinfo.txt
*.apk *.apk
*.unitypackage *.unitypackage
/.vs /.vs
**/node_modules/*

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "Examples~"]
path = Examples~
url = https://github.com/Unity-UI-Extensions/com.unity.uiextensions-examples.git

@ -1 +0,0 @@
Subproject commit 2b2dba57650838e285c3336b4a26847931462570

View File

@ -29,7 +29,7 @@ In this repository is a collection of extension scripts / effects and controls t
You can either download / fork this project to access the scripts, or you can also download these pre-compiled Unity Assets, chock full of goodness for each release: You can either download / fork this project to access the scripts, or you can also download these pre-compiled Unity Assets, chock full of goodness for each release:
## [Download - 2019.6 (aka 2.5)](https://unity-ui-extensions.github.io/Downloads) ## [Download Latest - Version 2.3](https://unity-ui-extensions.github.io/Downloads)
We have expanded where you can download the UnityPackage asset and widened the options to contribute to the project. We have expanded where you can download the UnityPackage asset and widened the options to contribute to the project.

View File

@ -16,6 +16,9 @@ namespace UnityEngine.UI.Extensions
[Tooltip("Enables 3d rotation for the particles")] [Tooltip("Enables 3d rotation for the particles")]
public bool use3dRotation = false; public bool use3dRotation = false;
[Tooltip("Enables using Renderer.lengthScale parameter")]
public bool _useLengthScale = false;
private Transform _transform; private Transform _transform;
private ParticleSystem pSystem; private ParticleSystem pSystem;
private ParticleSystem.Particle[] particles; private ParticleSystem.Particle[] particles;
@ -91,7 +94,7 @@ namespace UnityEngine.UI.Extensions
pRenderer = pSystem.GetComponent<ParticleSystemRenderer>(); pRenderer = pSystem.GetComponent<ParticleSystemRenderer>();
if (pRenderer != null) if (pRenderer != null)
pRenderer.enabled = false; pRenderer.enabled = false;
if (material == null) if (material == null)
{ {
var foundShader = ShaderLibrary.GetShaderInstance("UI Extensions/Particles/Additive"); var foundShader = ShaderLibrary.GetShaderInstance("UI Extensions/Particles/Additive");
@ -183,8 +186,6 @@ namespace UnityEngine.UI.Extensions
#else #else
Vector2 position = (pSystem.simulationSpace == ParticleSystemSimulationSpace.Local ? particle.position : _transform.InverseTransformPoint(particle.position)); Vector2 position = (pSystem.simulationSpace == ParticleSystemSimulationSpace.Local ? particle.position : _transform.InverseTransformPoint(particle.position));
#endif #endif
float rotation = -particle.rotation * Mathf.Deg2Rad;
float rotation90 = rotation + Mathf.PI / 2;
Color32 color = particle.GetCurrentColor(pSystem); Color32 color = particle.GetCurrentColor(pSystem);
float size = particle.GetCurrentSize(pSystem) * 0.5f; float size = particle.GetCurrentSize(pSystem) * 0.5f;
@ -280,13 +281,29 @@ namespace UnityEngine.UI.Extensions
_quad[3].color = color; _quad[3].color = color;
_quad[3].uv0 = temp; _quad[3].uv0 = temp;
float rotation = -particle.rotation * Mathf.Deg2Rad;
var lengthScale = pRenderer.lengthScale;
if (_useLengthScale)
{
// rotate towards velocity
var normalizedVelocity = particle.velocity.normalized;
rotation = Mathf.Atan2(normalizedVelocity.y, normalizedVelocity.x);
}
else
{
lengthScale = 1f;
}
float rotation90 = rotation + Mathf.PI / 2;
if (rotation == 0) if (rotation == 0)
{ {
// no rotation // no rotation
corner1.x = position.x - size; corner1.x = position.x - size;
corner1.y = position.y - size; corner1.y = position.y - size * lengthScale;
corner2.x = position.x + size; corner2.x = position.x + size;
corner2.y = position.y + size; corner2.y = position.y + size * lengthScale;
temp.x = corner1.x; temp.x = corner1.x;
temp.y = corner1.y; temp.y = corner1.y;
@ -339,7 +356,7 @@ namespace UnityEngine.UI.Extensions
else else
{ {
// apply rotation // apply rotation
Vector2 right = new Vector2(Mathf.Cos(rotation), Mathf.Sin(rotation)) * size; Vector2 right = new Vector2(Mathf.Cos(rotation), Mathf.Sin(rotation)) * size * lengthScale;
Vector2 up = new Vector2(Mathf.Cos(rotation90), Mathf.Sin(rotation90)) * size; Vector2 up = new Vector2(Mathf.Cos(rotation90), Mathf.Sin(rotation90)) * size;
_quad[0].position = position - right - up; _quad[0].position = position - right - up;

View File

@ -287,7 +287,7 @@ namespace UnityEngine.UI.Extensions
PopulateMesh (vh, m_points); PopulateMesh (vh, m_points);
} }
else if (m_segments != null && m_segments.Count > 0) { if (m_segments != null && m_segments.Count > 0) {
GeneratedUVs (); GeneratedUVs ();
vh.Clear (); vh.Clear ();
@ -480,4 +480,4 @@ namespace UnityEngine.UI.Extensions
} }
} }
} }
} }

View File

@ -11,25 +11,11 @@
} }
], ],
"unity": "2020.3", "unity": "2020.3",
"repository": {
"type": "git",
"url": "git+https://github.com/Unity-UI-Extensions/com.unity.uiextensions.git"
},
"bugs": {
"url": "https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues"
},
"keywords": [ "keywords": [
"Unity3D", "Unity3D",
"Unity", "Unity",
"Unity UI", "Unity UI",
"UI Extensions" "UI Extensions"
], ],
"samples": [
{
"displayName": "UI Extensions Samples",
"description": "Examples and demonstrations of the Unity UI Extensions controls",
"path": "Examples~"
}
],
"license": "BSD3" "license": "BSD3"
} }