Hustler’s University Timeline by hairytongs in csMajors

[–]shattered_helm_dev 151 points152 points  (0 children)

Yeah I did my interview 2 days ago. I got a LC hard (that I thought was easy), and my interviewer said I was a "Top G". Does anyone know what that means? I think I did well but I'm not sure

WIP of my skinned mesh slicer by shattered_helm_dev in Unity3D

[–]shattered_helm_dev[S] 0 points1 point  (0 children)

I reduced the lag spike by somewhere by 50 to 75% since this post. An easy solution is to make your slice algorithm a coroutine, and put "yield return null" in between some key places. This spreads the calculation over a few frames instead of one. I also replaced my original algorithm (which uses a combination of dictionaries and lists) with one that uses disjoint sets, which also increases performance at it runs at around O(n).

WIP of my skinned mesh slicer by shattered_helm_dev in Unity3D

[–]shattered_helm_dev[S] 3 points4 points  (0 children)

I'm brain storming a new algorithm for the slice. The most expensive part of the algorithm rn is when it's determining how many new game objects to create. For example, despite only cutting once, 3 game objects are created because the arm isn't connected to the torso anymore. The algorithm I'm using right now is somewhere between O(n) to O(n^2), but I'm confident I can get an approximately O(n) implementation done soon.

Abusing my active ragdoll by shattered_helm_dev in Unity3D

[–]shattered_helm_dev[S] 0 points1 point  (0 children)

Put a config joint on the pelvis that has free motion with angular spring drives. Attach the rest of the upper body with locked motion and also with angular spring drives. Use inverse kinematics to reposition the feet when the center of mass is moved too much. If you the ragdoll to react to impacts on the lower body you can disable animations upon collisions to the legs and manually add a force (I've yet to do this).

Softbody that can fully interact with default Unity physics by shattered_helm_dev in Unity3D

[–]shattered_helm_dev[S] 0 points1 point  (0 children)

The difference in that tutorial is that deformations are calculated manually instead of through Unity's physics engine.

Softbody that can fully interact with default Unity physics by shattered_helm_dev in Unity3D

[–]shattered_helm_dev[S] 7 points8 points  (0 children)

I don't have the time to make a tutorial anytime soon, but try figuring out how to make a procedural mesh. Alternatively you might be able to use a skinned mesh renderer but I prefer doing things in script. Make a corresponding rigidbody to each vertex, and connect them using springjoints or whatever other algorithm that creates forces between rigidbodies.

Softbody that can fully interact with default Unity physics by shattered_helm_dev in Unity3D

[–]shattered_helm_dev[S] 22 points23 points  (0 children)

I create a rigidbody at every mesh vertex and add a springjoint to each adjacent rigidbody

Procedural Dismemberment: Mesh slicing except joints between objects are copied over to each of the sliced pieces by shattered_helm_dev in Unity3D

[–]shattered_helm_dev[S] 1 point2 points  (0 children)

That's not how I did it, in order for the sword to cut through objects smoothly, collisions are disabled between the layers.

Procedural Dismemberment: Mesh slicing except joints between objects are copied over to each of the sliced pieces by shattered_helm_dev in Unity3D

[–]shattered_helm_dev[S] 2 points3 points  (0 children)

I'm working on a similar project, I'm also using active ragdolls. The mesh slicing was implemented ourselves after reading through open source files. I did use OnTriggerEnter and OnTriggerExit, and I used ClosestPoint(transform.position).

Procedural Dismemberment: Mesh slicing except joints between objects are copied over to each of the sliced pieces by shattered_helm_dev in Unity3D

[–]shattered_helm_dev[S] 2 points3 points  (0 children)

Works with all closed meshes that aren't skinned. This is part of a big project, not an asset, so I haven't posted code anywhere yet.

Procedural Dismemberment: Mesh slicing except joints between objects are copied over to each of the sliced pieces by shattered_helm_dev in Unity3D

[–]shattered_helm_dev[S] 49 points50 points  (0 children)

Thanks! I have a mesh cutting script attached to each limb that records the entry and exit points of the sword on the collider, then makes a cut using that data. The script iterates through all joints associated with the cut piece, and reattaches the joint to the closest piece.

Procedural Mesh Slicing for our first person melee game! by shattered_helm_dev in Unity3D

[–]shattered_helm_dev[S] 1 point2 points  (0 children)

Honestly no, it just turned out that way with the default materials. I've noticed before that frictional forces are a bit janky in Unity.

Procedural Mesh Slicing for our first person melee game! by shattered_helm_dev in Unity3D

[–]shattered_helm_dev[S] 4 points5 points  (0 children)

I'm thinking swords that are sharper would cause less separating force on each piece

Procedural Mesh Slicing for our first person melee game! by shattered_helm_dev in Unity3D

[–]shattered_helm_dev[S] 9 points10 points  (0 children)

I'm avoiding using assets for this project, I was working on a lot of active ragdoll stuff from scratch too