warp icon indicating copy to clipboard operation
warp copied to clipboard

[BUG] `integrate_particles()` does not set `x_new` when `~PARTICLE_FLAG_ACTIVE`

Open etaoxing opened this issue 9 months ago • 1 comments

Bug Description

A potential bug when using add_cloth_grid(fixed_left=True) in integrate_particles() https://github.com/NVIDIA/warp/blob/v1.6.2/warp/sim/integrator.py#L35-L36

If x_new = state_1.particle_q is initialized to zeros instead of copied from model (I’m doing this when using graph capture), then these particles will be moved to the origin. Would it be better to have this instead?

    tid = wp.tid()

    x0 = x[tid]
    v0 = v[tid]
    f0 = f[tid]

    if (particle_flags[tid] & PARTICLE_FLAG_ACTIVE) == 0:
        x_new[tid] = x0
        v_new[tid] = v0 # or 0.0
        return

System Information

No response

etaoxing avatar Apr 04 '25 20:04 etaoxing

@etaoxing Thanks for reporting the bug. @AnkaChan made a fix for this incorporating your suggestions: 77c3bda1e051e853c1e7012e3668184dfb7c97c8 Please give it a try (should already be in the nightly build), thanks!

shi-eric avatar May 05 '25 20:05 shi-eric