Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Try to modify the velocity
#1
Code:
void Start()
{
     m_solver.OnSimulationEnd += ColorFromVelocity_OnInterpolate;
}

private void ColorFromVelocity_OnInterpolate(ObiSolver solver, float simulatedTime, float substepTime)
{
     if (solver.backendType == ObiSolver.BackendType.Compute)
     {
         m_computeShader.SetFloat("DeltaTime", Time.deltaTime);
         m_computeShader.SetBuffer(0, "ObiVelocityBuffer", solver.velocities.computeBuffer);
         int threadGroups = ComputeMath.ThreadGroupCount(solver.allocParticleCount, 128);
         m_computeShader.Dispatch(0, Mathf.CeilToInt(threadGroups), 1, 1);
     }
}
Code:
RWStructuredBuffer<float4> ObiVelocityBuffer;
float DeltaTime;

[numthreads(128,1,1)]
void CSMain (uint3 id : SV_DispatchThreadID)
{
    ObiVelocityBuffer[id.x] = float4(0, DeltaTime*10, 0, 0);
}

I followed the instructions on this page and tried applying extra force, but nothing seems to have changed.
Did I do something wrong?
Reply


Messages In This Thread
Try to modify the velocity - by a172862967 - 11-08-2024, 10:39 AM
RE: Try to modify the velocity - by josemendez - 12-08-2024, 07:44 AM
RE: Try to modify the velocity - by a172862967 - 12-08-2024, 09:55 AM
RE: Try to modify the velocity - by josemendez - 12-08-2024, 10:52 AM