Trigger action on RBD collision
3034 4 0- EugeneRockstar
- 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
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
- Enivob
- 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
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
- EugeneRockstar
- Member
- 22 posts
- Joined: June 2009
- Offline
- EugeneRockstar
- Member
- 22 posts
- Joined: June 2009
- Offline
- Enivob
- 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.
Now only the cube impact increases light intensity.
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; } } } }
Edited by Enivob - Jan. 31, 2020 09:40:01
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
-
- Quick Links