This repository has been archived on 2023-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
station_obscurum_unity/Assets/Scripts/Darkness/VectorFieldHandler.cs

33 lines
918 B
C#
Raw Normal View History

2023-04-08 07:23:11 +02:00
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.VFX;
public class VectorFieldHandler : MonoBehaviour
{
2023-06-01 17:03:48 +02:00
[SerializeField] private float avoidanceDist;
[SerializeField] private List<Vector3> avoidances;
[SerializeField] private Vector3 size;
[SerializeField] private VisualEffect effect;
2023-04-08 07:23:11 +02:00
private Texture3D vField;
// Start is called before the first frame update
2023-06-01 17:03:48 +02:00
private void Start()
2023-04-08 07:23:11 +02:00
{
vField = new Texture3D((int)size.x, (int)size.y, (int)size.z, TextureFormat.RFloat, 0);
2023-06-01 17:03:48 +02:00
for (var x = 0; x < size.x; x++)
for (var y = 0; y < size.y; y++)
for (var z = 0; z < size.z; z++)
vField.SetPixel(x, y, z, new Color(1, 0, 0, 0));
2023-04-08 07:23:11 +02:00
//vField.SetPixel(0, 0, 0, new Color(1, 0, 0, 0));
effect.SetTexture("VectorField", vField);
}
// Update is called once per frame
2023-06-01 17:03:48 +02:00
private void Update()
2023-04-08 07:23:11 +02:00
{
}
2023-06-01 17:03:48 +02:00
}