Unreal Engine How do we do penetration mechanics in 3D games?

Velomous

Member
Jan 14, 2024
265
227
How to make peen go inside puss? A question everyone asks themselves at some point.

But seriously, how are people doing it? I mean we can have a perfectly sound model, with bones to manipulate the mouth and vagina and even the anus, and sure, making the vagina or mouth open up based on proximity with the peen is easy enough I suppose...

But how do we actually make it go inside? I mean the head and pelvis have their own colliders, and we obviously need collisions working or instead of hips smacking into butts we'll have two characters clipping inside of each other, so we can't just disable the colliders.... Not to mention we actually need it to look like the penis is actually touching the vagina, kinda rough to do without collisions.

I can think of 2 or 3 ways to do it in theory, but they are really shitty ways (such as disabling the colliders!)

So how are people actually doing it in games where dynamic penetration needs to be possible, such as VAM or Villain Simulator or Naughty Sandbox?
 

Velomous

Member
Jan 14, 2024
265
227
you can use different collision channels and setup collision with only what you want.
So you mean like disabling pawn to pawn collision? I discussed that option in the OP, but then you'd just be dealing with clipping instead.

How do we actually do something like ?
 

witcher234

Newbie
Dec 20, 2020
78
24
Either done by skinning it to several bones along edge. And colliding rod with collision spheres on bones (just like how meta human mouth is rigged). Or using softbody physics using niagra sping physics. Which is very difficlut to do with chars
 

TheExordick

Member
Sep 25, 2021
103
108
Generally, it is done manually during animation phase with morph targets for opening and closing vagina, anus and so on.
The problem of doing it procedurally, physics based, inside the engine is the performance cost.

How do we actually do something like ?
This is probably done with a mixture of things: physics assets, with carefully tuned colliders (to open and close the hole), materials and maybe cloth simulation to mimic the softness of the skin.
And i have to say it is an incredible technical showcase!

In UE you can have multiple physical asset for each skeletal mesh and while the main one may not be simulated, you can attach and simulate a second physical asset in the animation blueprint. So, you can create a phys asset for the vagina and anus to be simulated while the rest of the body is not simulating. You can detect physical collisions with other physical assets and depending on the precision of the rig you can have very good results.
 

Velomous

Member
Jan 14, 2024
265
227
Generally, it is done manually during animation phase with morph targets for opening and closing vagina, anus and so on.
The problem of doing it procedurally, physics based, inside the engine is the performance cost.



This is probably done with a mixture of things: physics assets, with carefully tuned colliders (to open and close the hole), materials and maybe cloth simulation to mimic the softness of the skin.
And i have to say it is an incredible technical showcase!

In UE you can have multiple physical asset for each skeletal mesh and while the main one may not be simulated, you can attach and simulate a second physical asset in the animation blueprint. So, you can create a phys asset for the vagina and anus to be simulated while the rest of the body is not simulating. You can detect physical collisions with other physical assets and depending on the precision of the rig you can have very good results.
That was done in VAM actually, it's not a technical showcase it's a plugin called naturalis, it just works (tm) it's in unity not unreal (tho that's kinda besides the point), but multiple physical assets for one skeletal mesh? at the same time? how? or do you mean just switching dynamically between physical assets based on conditions?
 

TheExordick

Member
Sep 25, 2021
103
108
That was done in VAM actually, it's not a technical showcase it's a plugin called naturalis, it just works (tm) it's in unity not unreal (tho that's kinda besides the point), but multiple physical assets for one skeletal mesh? at the same time? how? or do you mean just switching dynamically between physical assets based on conditions?
I've seen later that it was done in Unity, you are right, impressive nonetheless!

Inside the anim bp of a character you can call the node named "Rigid Body" and use it to simulate a physical asset.
But now that i look better at it, it looks like it overrides the previous phys asset. So i might be wrong.
I don't know why i thought you could concatenate more than one of this nodes and all of them would simulate.

1717426123504.png
 
  • Like
Reactions: Velomous

TAU9

New Member
Oct 11, 2022
10
4
You can absolutely disable mesh/capsule/etc collision on a pawn. Are you doing procedural animation or something? If not just make sure the two animations are in sync with each other and there's no clipping. If you try to use the skeletal physics asset you will have the opposite of clipping because the skeletal physics asset bodies will be too large.

Doing something like the penetration above would be insanely impressive but also unnecessary unless again you're trying to do procedural animation. In my projects I just have morph target curves running alongside the animation.

Edit - maybe you could look at Chaos Flesh or a marketplace physics plugin like
 
  • Like
Reactions: TheExordick

Velomous

Member
Jan 14, 2024
265
227
You can absolutely disable mesh/capsule/etc collision on a pawn. Are you doing procedural animation or something? If not just make sure the two animations are in sync with each other and there's no clipping. If you try to use the skeletal physics asset you will have the opposite of clipping because the skeletal physics asset bodies will be too large.
Procedural animation is exactly what I'm trying to do, e.g. less like illusion and kiss games, more like VAM.

The physics asset bodies being too large is exactly the problem, I have a few ideas, cloth physics or chaos flesh seem the best options for softbody but that doesn't necessarily solve these collision issues. In the physics asset there is a per collider setting where I can set complex collision as simple which although visually doesn't seem to do anything in the PhAT editor, it should in theory make the collider precisely match the mesh (it should be equivalent to per-poly collision), I haven't tested it yet though, but after i set up a proper environment for testing all this stuff it's where i'm planning to start.
 
  • Like
Reactions: TheExordick

TAU9

New Member
Oct 11, 2022
10
4
Complex as simple is for static meshes. AFAIK it won't have any effect on a skeletal mesh as a skeletal mesh physics asset is made up of rigid bodies assigned to bones. I could be wrong though.
 

AdeptusSteve

Member
Game Developer
Jun 9, 2017
184
1,335
If you werent going for fully proceduralized animations Id suggest including genital deformation in your maya or blender rigs and hand-keying the penetration there along with the rest of the animation. That will produce by far the best results.

We played around with a few procedural penetration systems in UE4 and I think the best one was to track the depth and direction of the penis tip bone past the vagina "entrance" and map that to a set of shapes.
The second part was to apply an IK system to the penis with a fixed set of control points on the vagina, and blend into it when it comes close to the vagina.

Havent messed around with the UE5 flesh deformer thingies but I suspect it could also be setup to work quite nicely if the skeletal animation is stable and favorable.
But I have to add that in all my time researching and developing around these things, the visual results never came close to just manually animated scenes but that could be due to my lack of skills in that direction. Anyway, I do get the appeal of fully procedural animations, its a nice thing to witness.

I wish you good luck with this, keep us updated (y)
 

WarmGourd

New Member
Mar 30, 2024
11
11
I've been working on something similar to this myself for the past several months and can say with relative confidence that this is achieved using physics joints (lots of Configurable Joints most likely in Unity) and a (more than likely) proprietary pseudo soft body solution. That's not to say that an asset store asset couldn't get you close to the mesh deformation shown. The ones that come to mind are Obi Softbody or Vertexmotion but would require lots of work to get looking right. Hopefully this can point you in the right direction with regards to similar assets you could use for Unreal.

The way that I've approached the problem is much the same as I've mentioned above. Rigged and weighted genitals, LOTS of Rigidbodies, Configurable Joints and coding to ensure that they all play nicely together. Unfortunately Unity's physics can be temperamental when there's so much going on; so achieving a stable physics simulation has proved to be trickier than I had envisioned, especially when it comes to the procedural animation, active ragdolls, full body inverse kinematics and "smooshing of parts" having to work together at the same time.

I have it at a point where I would consider it at 90 percent stable under most of my tested circumstances but there's still the odd stray interaction causing the simulation to go into overdrive. I'm sure I'll get it worked out in due course but I suppose what I'm trying to say is; Think very carefully before you go down this path. It's going to require a massive amount of work.

Whatever you choose to do. Good luck.
 

Velomous

Member
Jan 14, 2024
265
227
Hehe, I got some rudimentary genital collision going using physics asset, but to test it properly i need to have a dildo that I can properly line up with said genitals to further test how it behaves during actual penetration attempts.

While I was trying that (truly it's proving more challenging than it should, unreal's collision system can be a bit esoteric, whit things just magically not working for no reason sometimes, and pawnsenseing just mysteriously not working unless it's attached to a pawn, so i ended up having to use a sphere trace to detect proximity with the female for now, and then there is the lookat rotation which can be kinda weird sometimes, and getting the physics handle to play along with this is starting to look like a no-go)

But one of my attempts to just establish a baseline getting the dildo to rotate to 0,0,0 on-tick lead to this little blooper where the dildo is running away and i'm trying to catch it.
output.gif
 

WarmGourd

New Member
Mar 30, 2024
11
11
The way it's running and jumping has me chuckling far more than It probably should. That looks like a fun game in and of itself. Dildo hide and seek.

Anyway. I'm glad you're making progress, stick with it and thanks for the giggle.
 

Velomous

Member
Jan 14, 2024
265
227
Here's another stunning success!
output.gif
You don't have permission to view the spoiler content. Log in or register now.

Update: About a week later i finally managed to get it more or less like i want it, but damn that was orders of magnitude more work than i expected. It's an important mechanic for any procedural sex game so it was worth the effort, but damn. The problem really is that there's a million bad ways to do it, so finding a good way is just that much harder... And you'll ask stupid questions along the way like "should I just attach it to the female so it stays in place?" and "do i use physicshandle, or just force world position?... why? why not?" o_O

My current iteration uses two physicshandles. One that locks it into place between the vaginal opening and rotates it towards it when conditions are met, and one that i use to drag it around normally and if it is locked in place, moves it along a 'rail' in and out of the vagina. The biggest downside currently is that I can't wiggle it around because it's rotation is locked.

output.gif

As for how I make it go in and out based on the mouse movement relative to the dildo's orientation... Let's just call it black magic i suppose. :HideThePain:

Now that I can reliably test it though, I can shift my focus back to vagina collision.
 
Last edited:

Velomous

Member
Jan 14, 2024
265
227
It can be done with colliders. You can see it stretching and expanding on penetration in this gif.
output.gif
output.gif
You don't have permission to view the spoiler content. Log in or register now.

I haven't spent a lot of time on refining it (or any really, i just created the collider shapes for different parts of the vagina, it's super barebones)

Colliders can certainly be used to open up the vagina at least, but i doubt by itself this approach will ever look particularly good, probably best if it's combined with either procedural animation (if it has the right bones for it, which this model kinda doesn't I think), mesh deformation (they're adding it back for SKM in ue 5.5) or morphs as suggested by adeptus steve.
 
Last edited: