updated
This commit is contained in:
42
Assets/Scripts/Darkness/VectorFieldHandler.cs
Normal file
42
Assets/Scripts/Darkness/VectorFieldHandler.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.VFX;
|
||||
|
||||
public class VectorFieldHandler : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private float avoidanceDist;
|
||||
[SerializeField]
|
||||
private List<Vector3> avoidances;
|
||||
[SerializeField]
|
||||
private Vector3 size;
|
||||
|
||||
private Texture3D vField;
|
||||
[SerializeField]
|
||||
private VisualEffect effect;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
vField = new Texture3D((int)size.x, (int)size.y, (int)size.z, TextureFormat.RFloat, 0);
|
||||
for(int x = 0;x<size.x;x++)
|
||||
{
|
||||
for(int y = 0; y < size.y; y++)
|
||||
{
|
||||
for(int z = 0; z<size.z; z++)
|
||||
{
|
||||
vField.SetPixel(x, y, z, new Color(1, 0, 0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
//vField.SetPixel(0, 0, 0, new Color(1, 0, 0, 0));
|
||||
effect.SetTexture("VectorField", vField);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
Assets/Scripts/Darkness/VectorFieldHandler.cs.meta
Normal file
11
Assets/Scripts/Darkness/VectorFieldHandler.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 72a473445b963b24abc84791b0ffacaa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user