1
$\begingroup$

I have an array of objects that I applied the curve modifier to and then the Follow Path constraint, in order that the objects would follow the shape of the curve as they moved along it.

Unfortunately, the BGE doesn't accept the curve modifier, so the objects don't take the shape of the curve and only move in a straight line. No good!

I tried baking the actions, but that doesn't work either.

I've already reviewed similar questions on this site and they don't provide an answer.

So do I have to somehow get the LocRot values for each object in the array and manually make them follow the keyframe values I got from the bake?

$\endgroup$
4
$\begingroup$

Most modifiers do not work in the BGE, and only a few constraints work in the BGE. The only modifiers that work are the ones that are essentially applied before the game starts (edge split, solidify, subsurf, Etc) No modifiers will update during BGE runtime. As such, any modifier that usually changes the mesh data will not work. There are only a few constraints that work in the BGE, the rigid body joint is good example of one that works (and was designed for the BGE). Instead of using a Follow Path constraint, I would recommend using an armature for this. From what I understand, you want a bunch of objects to follow a curve, kind of like a hose between two moving parts.

You can do this with a solid mesh, or multiple separate objects, but the process is the same.

Start with the scene that you want to add your hose to. In this example, I will be using this lovely crane rig that I just threw together.

picture of pretty crane rig

It looks fine and lovely, but the cylinder needs a hydraulic hose. Lets model one. I'll use a curve to get the shape how I want it.

Picture of curve hose

Now I'm going to duplicate the cures, and move the extra copy to another layer in case we need to get back to the cure. Although it is unlikely we will need them, it is a good idea to make copies of objects like curves and objects with modifiers before you apply them, as doing so is usually not reversible. I'm also going to texture the hoses and add fittings for good measure.

Picture of fittings and hoses

Now I'm going to add an armature and extrude it along where the curve was, but only in the part where we want the hose bending.

enter image description here

I then parent the hose mesh to the armature using automatic weights. This will make Blender estimate what parts of the mesh the bones should control. In this case it worked perfectly, because the armatures are right where we want them, in the middle of the hose, and we ant the armatures controlling the vertices right around them. You may need to go into weight paint mode and modify it slightly depending on your specific circumstance, but if you are rigging a hose, this should not be necessary.

To make sure that this worked, we can go onto pose mode on the armature and test it.

enter image description here

We can select the last bone in the chain and apply an Inverse Kinematics Bone Constraint.

enter image description here

Add an empty at the end of the last bone on the chain. I'm calling this one Hose 1 End, but it could be anything. http://awesomehackforinlinetooltip.qqq/qoinbfoibg.png Parent that empty to the cylinder.

On the Inverse Kinematics constraint, set Hose 1 End as the Target. Check the rotation checkbox.

enter image description here

This will make the final bone in the rig align to the empty's rotation. Tweak the empty's rotation and position until the hose fits in the fitting.

enter image description here

Before we can test it, we need to add some logic on both armatures. A simple always - and - run armature is all that is needed.

enter image description here

Put that on both armatures.

If we test it now, the first hose should be working.

enter image description here

Now, we can simply repeat the process on the second hose. Add an empty at the tip of the final bone on that chain. Parent that empty to the cylinder Set an Inverse Kinematics Bone Constraint on that second armature. set the empty you just added as the target for that constraint. Check the rotation checkbox, and rotate the empty until the hose is in the right place.

If we test it now, everything should be working. (for the purposes of viewing, I have added a camera parented to an empty, with orbiting controls on the empty)

enter image description here

It works!! Yay!!

This process would also work for an array of objects, by simply applying the array modifier, and using the same basic string of armatures. You may want to use one armature for each object in your chain, and you may also have to use weight painting to make each bone control 100% of its corresponding object, but no other parts of the mesh. Other than that, this system will work for any sort of flexible chain, string, hose, Etc.

$\endgroup$
  • $\begingroup$ Where in this example does an object move along a curve? $\endgroup$ – Anthony Forwood May 21 '16 at 10:06
  • $\begingroup$ @AnthonyForwood From your question, I assumed that you wanted a curve to be able to control the movement of objects. Do you want the curve to actually act as a track for object to move along? $\endgroup$ – X-27 May 21 '16 at 16:08
  • $\begingroup$ Yes. I thought I was being perfectly clear. If you look at cegaton's answer to my question at this link, you'll see what I want to do. However, what he shows is not possible in the BGE, as I've since found out. I want to do the same thing in a game. blender.stackexchange.com/questions/52681/… $\endgroup$ – Anthony Forwood May 21 '16 at 20:35
  • $\begingroup$ Interesting. I actually faced a similar problem when I was animating pieces for a tank's track system. I ended up key framing all the track pieces on each frame. $\endgroup$ – X-27 May 21 '16 at 21:47
  • $\begingroup$ So what do I need to do? $\endgroup$ – Anthony Forwood May 22 '16 at 2:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.