From 6c8750768b64da06fb51be70602844abd7ba9811 Mon Sep 17 00:00:00 2001 From: SpoodyTheOne Date: Sun, 4 Feb 2024 00:39:58 +0100 Subject: [PATCH] Added random vel to blood --- Assets/Scripts/BloodComputeShader.cs | 2 ++ Assets/Scripts/ComputeShaders/BloodCompute.compute | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/BloodComputeShader.cs b/Assets/Scripts/BloodComputeShader.cs index 79a8d0a..c042516 100644 --- a/Assets/Scripts/BloodComputeShader.cs +++ b/Assets/Scripts/BloodComputeShader.cs @@ -264,6 +264,8 @@ public class BloodComputeShader : MonoBehaviour bloodCompute.SetVector("particleInitPos", loc); bloodCompute.SetInt("particlesToInitialize", found); + bloodCompute.SetVector("initialVelocity",Random.insideUnitCircle); + ComputeHelper.Dispatch(bloodCompute, amount, 1, 1, InitDustKernel); activeParticles += found; diff --git a/Assets/Scripts/ComputeShaders/BloodCompute.compute b/Assets/Scripts/ComputeShaders/BloodCompute.compute index 2679463..91ef7fc 100644 --- a/Assets/Scripts/ComputeShaders/BloodCompute.compute +++ b/Assets/Scripts/ComputeShaders/BloodCompute.compute @@ -15,11 +15,8 @@ RWStructuredBuffer freeParticles; uint numParticles; uint particlesToInitialize; float3 particleInitPos; +float3 initialVelocity; float deltaTime; -// float3 attractPos; -// float3 xAxis; -// float attractRadius; -// float attractForce; float3 mop1Pos; float3 mop2Pos; @@ -84,7 +81,7 @@ void InitDust (uint3 id : SV_DispatchThreadID) randState = hash(randState); nvel.xy *= scaleToRange01(randState); - particles[i].velocity = nvel; + particles[i].velocity = initialVelocity + nvel; particles[i].position = particleInitPos; particles[i].position.z = 0.01;