PDA

View Full Version : Deform object with Raycast???



leandropedrouzo
12-15-2013, 07:12 PM
Hi Guys!
I am having some troubles making a character squash over a non-planar floor. I tried SoftFX and Bulllet with no pleasant results. Then I thought that I coud just fake the soft-contact just by deforming one object with another (something similar to what old PolyFit used to do) but I couldn't find a plugin to do that. Then I had the crazy idea: can raycast be used to deform the geometry of one object to conform another?
I welcome any other ideas as well...

PS: a good floor contact (or object to object contact) is something I need in almost every project and I always ended up faking it or not doing it. There should be an easy way to achieve this without getting into complex simulations.

Thanks!!!!!

chikega
12-15-2013, 08:37 PM
You mean like this?:


http://www.youtube.com/watch?v=Luf3UrxeESY

leandropedrouzo
12-15-2013, 09:53 PM
well, that looks awesome! I'd even settle with a much more simpler contact flatten!

Ryan Roye
12-15-2013, 11:07 PM
For simple plane flattening, create ground plane null and leave it at its origin (or move its Y position to match the floor).

-Select the object that needs to deform based on Y-distance to this null

-Set the "Displacement Map Order" to "Before World Displacement"

-Click "T" and set a gradient with the input parameter of "Y distance to object"; that object being the null you created.

You can now use this gradient to fine-tune the flattening of whatever object you want. I consider this a quick-and-dirty method though, as it won't give you any bulging outward to simulate pressure, which would require a more complex setup.

leandropedrouzo
12-16-2013, 06:16 AM
For simple plane flattening, create ground plane null and leave it at its origin (or move its Y position to match the floor).

-Select the object that needs to deform based on Y-distance to this null

-Set the "Displacement Map Order" to "Before World Displacement"

-Click "T" and set a gradient with the input parameter of "Y distance to object"; that object being the null you created.

You can now use this gradient to fine-tune the flattening of whatever object you want. I consider this a quick-and-dirty method though, as it won't give you any bulging outward to simulate pressure, which would require a more complex setup.

Yes, I thought of a similar setup to fake it when you have a planar floor. But in this particular case that the floor is curvy it wont work.

RebelHill
12-16-2013, 06:41 AM
Yeah you can do it using raycast. Use the world object spot as input for the ray origin, and pipe the intersect output to displacement. You'll likely want to throw in various other nodes, such as a split and recombine vector to get displacement only along the Y axis, and also something to do masking, so as the displacement only occurs over a set area of the mesh, and only when it coems within a threshold distance (which you can get from the raycast too).

leandropedrouzo
12-16-2013, 12:15 PM
Yeah you can do it using raycast. Use the world object spot as input for the ray origin, and pipe the intersect output to displacement. You'll likely want to throw in various other nodes, such as a split and recombine vector to get displacement only along the Y axis, and also something to do masking, so as the displacement only occurs over a set area of the mesh, and only when it coems within a threshold distance (which you can get from the raycast too).

Thank you RH!
Today I HAVE to finish the shot, so I won't be trying it, but I definitely look into it later. :thumbsup: