Moving objects get "stuck" in static objects

Hello again…

There’s one thing that puzzles me for quite a time now: How do I avoid moving objects to move “into” other objects? In my case I’m moving an object with the mouse, and if I move it towards a static object fast enough it penetrates that object and gets locked. The collision sensor (of the moving object) then is constantly positive, but the moving object doesn’t get pushed out of the static one again.

The last days I tried some more or less ugly workarounds for that with backing up previous positions of the moving object and resetting its position to that when colliding. But this then gives me problems when I collide slower: the moving object then “sticks” to the static one (outside). This behavior is understandable for me, but I just didn’t find a better workaround so far…

For the playability of the game I can not reduce the moving objects’ speed any further.

Any suggestions? Has anyone maybe observed something similar?

Increase the number of physics sub-steps (I believe 2.49 and 2.55 should have this in the world settings)

It significantly increases precision, but may slow down massive physics scenes.

I’m guessing you’re using DLoc; don’t use that. Use Servo Motion, or failing that, Linear Velocity.

Do note, with the default value of 1 substep it’s not just DLoc that can fail, collision can still fail if you apply an extremely high LinV or move it with a high amount of force (heck with anything moving at high speed, that’s why the setting is exposed, for when high speed collisions are needed in a game)

@Ace - That’s true, but most games don’t move that fast, so I assumed that wasn’t the case.
@Zendoin - Like Ace said, if you move quickly in your game, use a higher Physics substep setting.

If you are using dLoc, you need to understand it essentially teleports the object and so it may sometimes teleport within the bounds of another. Apply a force, setting the linear velocity or using server motion is more suited for “moving” objects.

If you are doing it via python using the .position attribute or setPosition function you will want to instead find the vector from the object to the position you were originally setting the object to using the getVectTo function and than apply a force along that vector using the applyForce function.

Many thanks for the quick answers guys :slight_smile:

  • I’m already moving this thing by servo (makes it move nicer I think…). I move an invisible object with the mouse, and the actor is servo moved by this invisible object.
  • I also already played with the physics substeps as it seems, because I see that they are set to max (5)… I was rather thinking to LOWER this substeps, because when I use a lot of objects in the scene my machine seems not to be able to handle the physics any more (even if all of this objects are static, what seems strange, does a big number of static objects need so much physics calculation??)

I rather thought someone had maybe the same situation and found a nice workaround that does something like a “if you are stuck, get back out of the thing you are stuck in” - routine :smiley:

Just found out that reducing the substeps make it better for me… I still “get stuck”, but at least the moving object doesn’t get locked completely (Object penetrates the wall but can be moved out again).

In that case, you can increase the bound radius. On shaded or wire frame view, you can see the hatched circle around the object.

Just to be sure, are you using a collision bounds on your moving object? Maybe you’re not and that’s the problem… How fast is the character moving?

I’m using a compound collision boundary for this object and it’s moving at v<=100.
But as I said now that I reduced the physics substeps it behaves better… Strange, I know.

I just remembered that objects might get stuck if you have the friction high and insist on constantly moving the object forward, even into a wall. For example, if you are moving at:

obj[‘speed’] += 1

every frame and you hit a wall, it will continue moving at that speed (even though it’s hitting a wall), and so it will get stuck. You should decrease friction, or stop moving at that speed if you collide with something on the movement vector.