Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So, I have a StaticMeshComponent attached to an Actor:

Begin Object Class=StaticMeshComponent Name=StaticMeshComponentObject
    //Scale3D=(X=5, Y=1.5, Z=3) // ALMODEBUG
End Object

Ordinarily, the actor gets spawned, anything touching it gets bumped, and the actor despawns itself. If I set the Scale3D as a default property, everything works as I expect.

But I want to scale it at runtime, like this:

function SetImpulseComponentTemplate(QuadForceBoxImpulseComponent Value)
    Local Vector ScaleVec;

    ScaleVec.X = Value.Length;
    ScaleVec.Y = Value.Width;
    ScaleVec.Z = Value.Height;

When I do this, the thing only collides as if it were not scaled. If I leave the actor spawned so I can see it, it is scaled. If I also "show collision", the collision displays correctly as well.

Is there a prohibition against scaling collision shapes at runtime?

share|improve this question
Never used the UDK so far, so just as a comment: I'd guess you have to notify the physics engine of the changed attributes. It probably won't update "on the fly" to not update everything once a single Attribute changes (to allow Batches of changes happen at once). – Mario Nov 21 '12 at 1:15
Ok, will try looking for that tomorrow. – Almo Nov 21 '12 at 2:33
I'm not sure what the behavior in UDK would be, but I've done this before in Unity, and things get pretty unstable. The process of scaling is not something checked by a physics engine, so it will likely allow a scaling operation to cause the mesh to expand beyond the bounds of the environment it must fit in, and the simulation freaks out from there. In my implementation, I had to raycast around the object to determine first whether it could scale, and also had to tweak it's position upward so that it did not clip the floor. In sum, I'd warn you that things can get messy. – ktodisco Nov 21 '12 at 5:32
Yup, too messy. Will put it in the default properties. – Almo Nov 21 '12 at 16:51

Just as a note, "show collision" only shows the default collision. You need to "nxvis collision" to show the physics collision. You'll notice if you scale at runtime the default collision scales, but the physics one stays at the initial value. I myself am struggling with this issue atm. I think the only hope is to remove the mesh (and physics) and re-add it after scaling the actor, then manually reinitialise the rigidbody physics system. The last part I can't get to work without massive errors, the furthest I've got is the physics collision updating to the correct size, but then everything is frozen.

Here is a link to a thread about the issue, there is a link in the 6th post with another more detailed thread.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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