Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lock Softbody Movement & Cut it
#2
(27-05-2020, 06:42 AM)arrnav96 Wrote: I'm making a softbody cutting game. A knife stays above the softbody object (Slime) and can be moved vertically down in a straight motion plane (Y-plane only) by user touch drag to "cut" a piece off the slime. (The knife does not rotate during the motion, only moves up and down). The plane of cutting can be selected by moving the knife above in any horizontal direction. (X-plane only)

I want the spherical slime softbody to appear to be 'frozen' or hovering just above a platform below it (Frozen position and rotation), but STILL be affected by the knife if user touches it (Bend inwards when knife is penetrating the slime). Once the knife penetrates to a deep enough Y-position inside the slime, I use a mesh cutting tool (Ezy Slice) to cut off the mesh at that Y-plane and will instantiate a new softbody (Generating new blueprint and softbody cut piece) which falls off to the platform below.

----

Two questions:

1. How do I lock the position of a softbody upon instantiating it's prefab? What if I want to define my own spawn position and lock the object there? The transform does not seem to be in sync with the object's actual position once it touches anything and slightly moves. (And yes, I have made the 'main' softbody a child of an empty parent object and then tried moving). Currently it seems to move away if the knife touches it from above. 

2. Is the aforementioned kind of mesh cutting possible? The cutting usually works very well with non-softbody regular meshes, but I'm thinking how do I go about cutting off a part of the main softbody considering the original mesh is no longer preserved because of the particle based way Obi softbody works? 

The mesh cutting algorithm is such that at the cutting plane, the original mesh is destroyed and two new meshes are generated preserving their positions with respect to the original object. The cross section of both meshes use the material of original object. 

------

My plan is -

1. When the knife reaches cutting Y-position, Preserve mesh shape of the softbody in it's instantaneous "bent" shape, then pass THAT on to the mesh cutter.

2. Destroy the original softbody, generate two new meshes and their shapes and position being the same as previous state of main softbody, then generate their blueprints and convert them to softbodies, then add gravity to the smaller piece so it falls off to the platform below.

3. The above two steps need to happen at a duration of below 1 second or so. As the mesh cutting works very fast with regular meshes (Any polycount and shape on mobile), the only hindering factor I see here is the time taken to generate blueprint and softbody on runtime.

Will this work?

Hi there,

1.- To "lock" the position of a softbody, you must lock at least one of its particles. Define a particle group in the blueprint editor, then attach it to a transform using a particle attachment.

2.- Mesh cutting using the plan you outline (feed the mesh in its deformed state, split it, generate two new blueprints from the two chunks) should work, but probably not in realtime unless your softbody is extremely simple. Blueprint generation performance is far from realtime, there's a reason why it is a coroutine: you generally dispatch it, then wait a while for it to be done. You mention a < 1 second delay is acceptable, this will depend a lot on how many particles/vertices you have and how large your cluster radius is.
Reply


Messages In This Thread
Lock Softbody Movement & Cut it - by arrnav96 - 27-05-2020, 06:42 AM
RE: Lock Softbody Movement & Cut it - by josemendez - 27-05-2020, 09:11 AM
RE: Lock Softbody Movement & Cut it - by arrnav96 - 27-05-2020, 09:51 AM
RE: Lock Softbody Movement & Cut it - by arrnav96 - 27-05-2020, 10:39 AM
RE: Lock Softbody Movement & Cut it - by arrnav96 - 27-05-2020, 10:59 AM
RE: Lock Softbody Movement & Cut it - by arrnav96 - 27-05-2020, 01:20 PM
RE: Lock Softbody Movement & Cut it - by arrnav96 - 01-06-2020, 10:36 AM
RE: Lock Softbody Movement & Cut it - by arrnav96 - 01-06-2020, 12:24 PM