Trigger action on RBD collision

   3033   4   0
User Avatar
Member
22 posts
Joined: June 2009
Offline
Hey.

Does anyone know how I could trigger other parameters when certain objects collide ?

For instance, a RBD sphere drops, hits the floor and upon the hit, that activates the intensity of a light to 1

Or

When it hits, it triggers another object to begin moving - Rube Goldberg style. I could keyframe it, but I'm trying to make it as dynamic as possible.

Thanks for any guidance !

Eugene
User Avatar
Member
2629 posts
Joined: June 2008
Offline
There is a mechanism call “Impact”. You can fetch those records on a frame by frame basis. In this example, if an impact is detected, the light intensity is set to 10.0, otherwise 0.25.
Edited by Enivob - Jan. 23, 2020 09:36:23

Attachments:
impact_drives_light.hiplc (657.6 KB)
impact_light.gif (157.7 KB)

Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
22 posts
Joined: June 2009
Offline
Ah cool .. thanks for the help
User Avatar
Member
22 posts
Joined: June 2009
Offline
Hey.

File works great.

Is there a way to get it to monitor the collision of a certain object, rather than all collisions ?

Thanks

Eugene
User Avatar
Member
2629 posts
Joined: June 2008
Offline
There is additional data that you can “mine” to generate more complicated scenarios. For instance, you can examine the @otherobjid attribute, which contains the index to the object that the impact candidate is colliding with. In this case I have the floor, otherobjid=0 and the cube, otherobjid=1.

If we extend the code running in the Detail scope of a wrangle, we can pull in that attribute and filter for a specific object.
f@light_intensity = 0.25;
int n = npoints(0);
if(n>0) {
    int success = 0;
    // Loop through each impact point.
    for (int i=0; i<n; i++){
        int collide_id = pointattrib(0,"otherobjid",i,success);
        if (success==1){
            // Attributute exists.
            // Check unique ID to filter.
            if (collide_id==1){
                // Impact not with id 0 (ground plane)
                f@light_intensity = 10;
            }
        }
    }
}
Now only the cube impact increases light intensity.
Edited by Enivob - Jan. 31, 2020 09:40:01

Attachments:
impact_only.gif (33.7 KB)
impact_drives_light.hiplc (752.8 KB)

Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
  • Quick Links