taichi-dev / taichi

Productive, portable, and performant GPU programming in Python.
https://taichi-lang.org
Apache License 2.0
25.58k stars 2.29k forks source link

Could Taichi be used for 3D object collision detection? #798

Closed ANYMS-A closed 4 years ago

ANYMS-A commented 4 years ago

Concisely describe the proposed feature Hi, I was recently doing a task related with collision detection. I need to detect whether the mesh vertices of clothes intersected with the vertices of human body mesh, while the 3D position of these vertices are given.

I'd like to know could mpm method be used to solve this problem fastly?

Many thanks!

archibate commented 4 years ago

to detect whether the mesh vertices of clothes intersected with the vertices of human body mesh, while the 3D position of these vertices are given.

Intresting, not sure if this helps: https://github.com/yuanming-hu/taichi/blob/master/examples/mpm_lagrangian_forces.py

Applying forces to grid body on collision. I may write a 3D version if you want :-)

ANYMS-A commented 4 years ago

to detect whether the mesh vertices of clothes intersected with the vertices of human body mesh, while the 3D position of these vertices are given.

Intresting, not sure if this helps: https://github.com/yuanming-hu/taichi/blob/master/examples/mpm_lagrangian_forces.py

Applying forces to grid body on collision. I may write a 3D version if you want :-)

Hi, I'd like to run the demo of the link you gave out, but it raise an error:

[Taichi] mode=release
[Taichi] version 0.6.19, llvm 10.0.0, commit 9f11a55e, python 3.7.6
[Taichi] Starting on arch=metal
Traceback (most recent call last):
  File "/Users/crissallan/PycharmProjects/TaiChi_Learning/course_1/mpm_lagrangian_force.py", line 20, in <module>
    x = ti.Vector.field(dim, dtype=ti.f32, shape=n_particles, needs_grad=True)
AttributeError: 'function' object has no attribute 'field'

How should I fix it ? Many thanks!

archibate commented 4 years ago

Please upgrade to latest Taichi v0.6.22:

python3 -m pip install --upgrade taichi
ANYMS-A commented 4 years ago

Please upgrade to latest Taichi v0.6.22:

python3 -m pip install --upgrade taichi

Many thanks!