Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Tritize · Mar 18, 2020 at 05:37 PM · collision detectionnvidiasoftbody

Collision detection with NVIDIA FLex ????

Hi,

I'm trying since several days now to get this working and I can't figure it out. I'm trying to mess around with the Nvidia flex plugin for Unity. I would like to detect collisions between the soft bodies I created and other elements (player, simple shapes....). But I can't make it work. I found online that there is suppose to be a way with a method : flexGetContact(), but I've never been able to use that, and the documentation is inexistant...... I tried to add a trigger collider to my soft body, but when I apply a force to it the collider is moved instantly to the aimed position and not the soft body.... (even when the soft body is a parent of the collider, cf the attached image....).

alt text

So if someone know how to detect collisions between soft bodies from the flex plugin.......

capture.png (201.8 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by UNDERHILL · Oct 18, 2020 at 08:49 AM

Yes. I do. Kindof. I got particles working. Maybe you can adapt this for your needs.

I JUST got it working after several attempts over the past few years. And if you have been through the available tutorials carefully and understand flex and the unity particle system, this will all make sense to you;

Set up a flex actor container gameObject, add Flex Source Actor component to it.

On the flex source actor component check 'fluid' at a minimum. Configure like for your needs or like the tutorial.

Attach the 'flex particle controller' component to it.

Add the particle system component to it and configure;

Might want to set up a material or something, up to you.

Check 'Collision'.

Under collision select "World" as the "Type. Leave defaults for now.

Check 'send collision messages'.

Now the way that this works is not like you might be used to. A gameobject does not know that a particle hit it, but a particle system knows which gameObjects it hits.

Attach the script below to your flex actor gameobject.

The script will be logging the names of gameObjects with colliders hit by the particle system. You should be able to handle messaging, destroying or the collisions with those gameObjects from here. Don't forget you have many more particle collision settings, scale settings for particle size, you can make some super wicked stuff with this!!!

see also; https://www.youtube.com/watch?v=2IOXPnbHuvo

https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnParticleCollision.html

 using UnityEngine;
 using System.Collections;
 using System.Collections.Generic;
 
 public class ParticleCollisionDetector : MonoBehaviour
 {
     public ParticleSystem part;
     public List<ParticleCollisionEvent> collisionEvents;
 
     void Start()
     {
         part = GetComponent<ParticleSystem>();
         collisionEvents = new List<ParticleCollisionEvent>();
     }
 
     void OnParticleCollision(GameObject other)
     {
         Debug.Log("THIS PARTICLE SYSTEM HIT:" + other.name);
         // int numCollisionEvents = part.GetCollisionEvents(other, collisionEvents);
 
         // Rigidbody rb = other.GetComponent<Rigidbody>();
         // int i = 0;
 
         // while (i < numCollisionEvents)
         // {
         //     if (rb)
         //     {
         //         Vector3 pos = collisionEvents[i].intersection;
         //         Vector3 force = collisionEvents[i].velocity * 10;
         //         rb.AddForce(force);
         //     }
         //     i++;
         // }
     }
 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

127 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Problem with softbodies collisions 0 Answers

Walking on a sphere, add collisions 0 Answers

How to make arrow stick to environment ? 3 Answers

Inconsistent collision detection on slow-moving objects 0 Answers

How to activate a collider only for a certain animation, and then deactivate it 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges