Using an Empty to deform a mesh in BGE

Hi All,

I’m trying to animate a rubber diaphragm, which is pushed up/down in the center by a plunger, but locked in place at the outsides; I had used a hook to animate this deformation, but now I’m noticing that the hook doesn’t seem to animate in BGE when I start game mode.

Is there any way to get it to animate?
or
Is there another way to rig this diaphragm if I cannot use the hook?

Thanks in advance for any help.

I am not sure I am entirely clear on what you are doing, but why not use an armature and just rig the diaphragm to a bone that you scale up and down?

I can help,
you just need “always Run armature”

then move the ik target of the armature with actions or physics :slight_smile:

Attachments

MotorConcept (2).blend (428 KB)

Perhaps the attached images will help:

Frame 1 of animation:



Frame 10 of animation:

Currently, I use a hook (parented to the plunger) that deforms the central vertices of the diaphragm as I push the plunger down.

Is this possible to do with an armature?

yes, paint weights, and use a bone “Stretch” with a Ik target,

the Ik target can be the plunger,

if you are having trouble I could .blend /pic-paste you through

I think I have a demo from monster some where

If you have an example of that, I’d be very grateful!

Is there anyway you could post the blend? That would go a long way in helping the rest of us to understand the exact nature of the issue. You can definitely do that with an armature, but not using an armature doesn’t really explain why it isn’t working for you. The way I see it, for something simple like a single degree of freedom, there is no real benefit of preferring an armature to any other sort of control object.

Diaphragm_Hook.blend (551 KB)
I have attached my example .blend file here.

Basics:
I have a plunger, which is the parent of a Hook, which deforms a section of a mesh (Diaphragm) as if it pushes it.

I have also added a cube, whose parent is the hook, so I could see during Play Mode that it is actually moving.

In play mode, press [A] to start the animation sequence.

Ok well here is an armature solution.

You set this up by first parenting the diaphragm to the armature, and choosing ‘armature deform -> empty groups’. Then you parent the plunger to the bone and choose ‘bone’.

After this you have to select which verticies are deformed by the plunger bone, by going into edit mode for the diaphram, select the verticies in the loops around the head of the plunger, then go over to object data -> vertex groups, select ‘plungerbone’, and then ‘assign’.

I also locked transformation of the bone everywhere other than the up and down axis (which I think is the bone’s local y)

I had originally uploaded a solution with two bones and a constraint, but that was way to complex for this. But if you wanted the travel of the bone not to deform the diaphragm in the up direction (as if there is no physical attachment between the plunger and the diaphragm), you would need the second bone.

I think the issue with using empties for this is that the hook modifier doesn’t seem to have any implementation in the game engine. So armature it is.

Attachments

Diaphragm_Hook.blend (489 KB)

Hobomatic - How is the animation accomplished? I cant see any keyframes in the .blend you attached; yet it animates perfectly.

What am I missing?

The action and logic are associated with the armature instead of the plunger. I moved some stuff around XD.

edit

In the dopesheet editor, at the bottom, where it says ‘+ New’, click the icon next to that to get a dropdown with a list of actions (the action is called ArmatureAction). That will re-populate the dopesheet and timeline with the data for the action.

Thanks, now I see the animations, and have another question…

I have set up the parenting as you said, but I dont know how you animate the “PlungerBone” in the dope sheet. I can’t insert a keyframe for it?

Edit - Nope, figured that part out. My question now is how you “Select ‘plungerbone’…” - Bolded and underlined.

Nevermind; complete brain-fart… Wasn’t in pose mode.

Thanks so much for the help!

Yeah, not a problem. I imagine you will probably end up with a much more complicated machine to animate as you continue your project (whatever it is :P), and assuming you will have to use armatures for a large part of it, I highly recommend this video series, titled ‘Humane Rigging’:

It is the best rigging tutorial/explanation I have come across so far.