Flex (1.1) - User controlled object and collision handling


I’m a new developer of Flex - I’ve started exploring Flex 1.1 and plan to use it in a haptics project. Note that, I’m using standalone Flex (and not through Unreal Engine), and am using Windows 10/VS 2015. I’ve browsed through the samples and available documentation.
I believe there are a few basic things I’m missing, and could not find any direct suggestion/best practice recommendation in any of the reference material. So will appreciate any help with the following items:

  1. If I want to have an object which is directly user controlled (i.e. through input) - what is the best way for that? Should it be a Flex object (or should it be an external object/modeled with PhysX etc)?
    Right now I’ve setup a single particle as such - and am updating its position directly every frame based on user input (from keyboard/haptics controller). Is that fine?
    I could not find any samples/demos in Flex where any object is movable by the user, if I missed any please point.

  2. Is there a way to query/know if two objects have collided? I believe PhysX has similar functionalities, but could not find any in Flex. In regard to the previous question, if a user controlled object collides with a flex scene object, is there a way to know so custom code can be added?
    If yes, and if my custom object is a single particle, is there a way to know exactly what other particles it collided with?

Thanks a lot for your help. Again, if I’m missing something obvious thanks for your patience in explaining.

Cheers, Wiz

Hi! I’m using Flex with Unreal.

  1. I think your current approach is correct (is there really another way?). You can also use gravity and force fields to get the particle to move.

  2. I have working collision events for a Flex object (sphere) and a non-Flex cube, with collision information about the impact. This is using Unreal Engine 4. I have yet to make it work with a Flex emitter’s particle systems.

Not sure if I answer your questions or this really helps… I am also interested in knowing whether or not it is possible to get information about individual particles.

Hi Wiz,

I am facing the same problem with you. I am using a collision geometry as the user input object. I think there is no api or class can provide collision information for a object or particle. Some research works seem using individual collision detection module for user controlled object. The newest API provide an interface getNeighborParticles which may helpful to find potential collision. But finally I think I will choose to develop a collision method by myself and synchronize with Flex solver…

Thanks guys for your feedback. @br1one - I have not explored UE4+Flex much - but I believe the collision events are UE specific there.

@Edwinz_newer - thanks for your input. I also have been experimenting with collision geometry as the user-controlled object.
I found the lack of a collision event a bit odd since Flex is meant for games (where it’s very likely you will want things to happen (i.e. custom code) when objects collide). The function you mentioned (getNeighborParticles) - is it available in Flex 1.1?

Thanks once again for your comments.
Cheers!, Wiz

Never mind, saw that NvFlexGetNeighbors() is part of 1.2 (in release notes and in http://www.geeks3d.com/forums/index.php?topic=5032.0)

Yes, it is in 1.2. I am using collision geometry as user controlled object too. I think this may the best way to do it both on efficiency and flexibility. Hope they could provide a gpu buffer that returned collided particle indices so that it will be much more convenient…