Lightning
Created Lightning Gun effect (Uses LineRenderer, very slow) Created GPU Lightning renderer (very fast, still needs integration)
This commit is contained in:
parent
3a9ee2ccf7
commit
bb297bf84c
100 changed files with 7105 additions and 13 deletions
14
Assets/Plugins/GPUTrail/Sample/GPUTrailSample/AutoRotate.cs
Normal file
14
Assets/Plugins/GPUTrail/Sample/GPUTrailSample/AutoRotate.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class AutoRotate : MonoBehaviour {
|
||||
|
||||
public Vector3 rotSpeed;
|
||||
|
||||
|
||||
void Update () {
|
||||
|
||||
transform.Rotate(rotSpeed * Time.deltaTime);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 47e64413aeb5ae740b410d70fb05d20c
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class GenerateSphere : MonoBehaviour {
|
||||
|
||||
public GameObject prefab;
|
||||
public int num;
|
||||
public float radius;
|
||||
|
||||
void Awake () {
|
||||
|
||||
for(var i=0; i<num; ++i)
|
||||
{
|
||||
var pos = Random.insideUnitSphere * radius + transform.position;
|
||||
var go = Instantiate(prefab, pos, Quaternion.identity) as GameObject;
|
||||
if (go)
|
||||
{
|
||||
go.transform.SetParent(transform);
|
||||
go.GetComponent<Rigidbody>().velocity = Random.insideUnitSphere * 10f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if ( Input.GetMouseButton(0))
|
||||
{
|
||||
var pos = Camera.main.transform.position;
|
||||
var foward = Camera.main.transform.forward;
|
||||
|
||||
var go = Instantiate(prefab, pos + foward*2f, Quaternion.identity) as GameObject;
|
||||
if ( go )
|
||||
{
|
||||
go.transform.SetParent(transform);
|
||||
go.GetComponent<Rigidbody>().velocity = Camera.main.transform.TransformVector(Quaternion.Euler(Random.Range(-30f, 10f), 0f, 0f) * Vector3.forward * Random.Range(10f, 100f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
GUILayout.Label("SphereCount: " + transform.childCount);
|
||||
if ( GUILayout.Button("Clear") )
|
||||
{
|
||||
var num = transform.childCount;
|
||||
for (var i = 0; i < num; ++i)
|
||||
Destroy(transform.GetChild(i).gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c4a3d260b8b4b1049bf05a10bcc97301
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!134 &13400000
|
||||
PhysicMaterial:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Sphere
|
||||
dynamicFriction: 0
|
||||
staticFriction: 0
|
||||
bounciness: 1
|
||||
frictionCombine: 0
|
||||
bounceCombine: 0
|
||||
frictionDirection2: {x: 0, y: 0, z: 0}
|
||||
dynamicFriction2: 0
|
||||
staticFriction2: 0
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6b91e96dd2563eb45b1def3be8081baa
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
162
Assets/Plugins/GPUTrail/Sample/GPUTrailSample/Sphere.prefab
Normal file
162
Assets/Plugins/GPUTrail/Sample/GPUTrailSample/Sphere.prefab
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &139476
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 439476}
|
||||
- component: {fileID: 11439478}
|
||||
m_Layer: 0
|
||||
m_Name: GPUTrail
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!1 &139478
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 439478}
|
||||
- component: {fileID: 3339478}
|
||||
- component: {fileID: 13539478}
|
||||
- component: {fileID: 2339478}
|
||||
- component: {fileID: 5461184}
|
||||
m_Layer: 0
|
||||
m_Name: Sphere
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &439476
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 139476}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 439478}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!4 &439478
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 139478}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 5, z: 0}
|
||||
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||
m_Children:
|
||||
- {fileID: 439476}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &2339478
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 139478}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_Materials:
|
||||
- {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!33 &3339478
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 139478}
|
||||
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!54 &5461184
|
||||
Rigidbody:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 139478}
|
||||
serializedVersion: 2
|
||||
m_Mass: 1
|
||||
m_Drag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_UseGravity: 1
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 0
|
||||
m_CollisionDetection: 1
|
||||
--- !u!114 &11439478
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 139476}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6af463c098fe7e445addb01c1c7e5c49, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_cs: {fileID: 7200000, guid: f88322fe9ecec1e41b2a237407abddad, type: 3}
|
||||
_material: {fileID: 2100000, guid: c1c458d860a40bc4f836b8625223124f, type: 2}
|
||||
_life: 3
|
||||
_inputPerSec: 60
|
||||
_inputNumMax: 5
|
||||
_lerpType: 1
|
||||
_minNodeDistance: 0.1
|
||||
_startWidth: 0.1
|
||||
_endWidth: 0.1
|
||||
_debugDrawLogPoint: 0
|
||||
_debugDrawVertexBuf: 0
|
||||
--- !u!135 &13539478
|
||||
SphereCollider:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 139478}
|
||||
m_Material: {fileID: 13400000, guid: 6b91e96dd2563eb45b1def3be8081baa, type: 2}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Radius: 0.5
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 139478}
|
||||
m_IsPrefabParent: 1
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 34e81c32db6482d4c82c12160b1d7071
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
Loading…
Reference in a new issue