Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple Way to Attach Game Object?
#4
(21-11-2021, 01:47 AM)beegon Wrote: That makes sense and sounds like exactly what I need. I only know basic programming, but I will try to understand how to do this in the meantime. Thank you for the pointers!

Hi there,

Sorry for the delay, it's already tuesday. You can find the sample script attached. To use it, add the component to the object you want to attach, then drag the softbody to its "softbody" input.

What it does is it finds the particle that's closest to the object, and stores the object position/rotation in the particle's local space. At the end of every frame it just translates/rotates the object to match the stored position/rotation. A possible improvement would be to consider more than just the closest particle, but the "n" closer ones. This would essentially boil down to linear blend skinning (which is what the built-in ObiSoftbodySkinner component does on a per-vertex basis).

Note the object just goes along, has no interaction with the softbody at all. Here's a video:



Let me know how it goes Sonrisa


Attached Files
.cs   AttachToSoftbody.cs (Size: 2.79 KB / Downloads: 24)
Reply


Messages In This Thread
Simple Way to Attach Game Object? - by beegon - 20-11-2021, 09:13 PM
RE: Simple Way to Attach Game Object? - by beegon - 21-11-2021, 01:47 AM
RE: Simple Way to Attach Game Object? - by josemendez - 23-11-2021, 10:23 AM
RE: Simple Way to Attach Game Object? - by beegon - 23-11-2021, 08:08 PM