Bounding box problems

Alright, I think this will be my final question before I finally make a thread on the game I’ve been working on for a while…

Anyways, here’s the simple problem with hopefully a simple solution?

When my character runs up a semi-steep hill and stops, the character does a small jump. Like the bounding box moves up a little and then falls back to the ground from the gravity.

Does anyone know how I can prevent this from happening? I don’t want my character to jump after I stop walking… I put a very simple blend in the attachments to show what’s happening.

Any help would be awesome, please.

steep_moving.blend (415 KB)

Thanks,
~Linkxgl

Strange… This is expected when using loc for movement but You don’t do that. I changed movement to servo control but that turned out worse at first.

I then caped the y force to 20 and -20 for both movement and stop servo. It become better but slow.

I then raised mass to 100 to get a realistic density and raised force limits on y to 8000 for both servos. Jumping still…

I then put min z force to -8000 on the still servo (leaving max at 0). Then it behave sane :slight_smile:

But strange it is…

I have no idea, what exactly servo control does, but I have an idea.
WARNING: Full of assumptions.

Reading the description, I assume servo control tries to force the object
to your specified x/y/z velocity (which is 0,0,0 since you want your object to stop)
by applying a force on your object.

Whenever your object moves on a slope, its impulse is parallel to the slope,
so whenever you release your key, servo tries to stop the object by applying
a force antiparallel to your impulse.

Since the ground is a slope, eg not parallel to x/y/z, the servo force need to apply
a force with x/y/z components to create an antiparallel force.
In your actuator however, you limited the force in the y direction,
so your servo can only apply the force in the x and z direction!
Now, what does it mean? Let me draw a picture.
The z component of the impulse can’t be counteracted by servo control,
so the object continues its movement in the z direction!

I don’t know if this is a possible solution for your game,
but in your test file you can simply uncheck the x and z boxes,
allowing your servo to apply the force in all directions.


That’s actually exactly what’s happening… I think. I could uncheck both of the x and z, and that works perfectly, but I am not using a method like this. I made this as a quick example. The movement in my game is actually set by a script. I could set the Z movement to 0 when I stop moving, but there’s a problem with this. If I am walking down a cliff, the player hangs in the air when I stop moving. This is something I don’t want.

But it’s still a good idea. If I can tweak it out to where there is no motion on the z axis unless it’s in the air, it will work perfectly. Though, to me, it seems like a messy solution :confused:

Thanks both of you for the ideas… I’ll see what I can do, as for anyone else, I’d appreciate it if anyone had their own ideas on how to prevent this.

Change to “Rigid body”…

The problem with turning the object from dynamic to rigid body is that, if/when the box tips over all the local axis will be messed up. Again, the cube in the blend is just an example, it’s not my actual game. Getting hit by any object in the game world seems like it would totally mess this up, again, because it will tip. Especially since in my actual game, the bounding box is shaped kind of like an upside down cone.

Since you’re already using a script, I suggest you to cast a ray of roughly player length downwards.
If it hits something, it’s fine. If it doesn’t hit anything, apply a force/velocity downwards.

I can take a closer look if you’d upload a minimal file with your movement code and a small bit of area.

Why not just lock the player’s position via Python? Just cast a ray downwards, and if the player’s not jumping, lock him down.



cont = logic.getCurrentController()
obj = cont.owner

topos = obj.worldPosition.copy()
topos.z -= 10

ground = obj.rayCast(topos, None, 0, 'ground', 1, 1)

if ground[0] != None:
    obj.worldPosition.z = ground[1][2] + .5

That’s pretty much what I did :stuck_out_tongue: I guess that’s it then… Thanks everyone, I really appreciate it… All of it. :slight_smile: I’m really happy to be able to ask questions here and have them answered within days and sometimes even hours.

Thanks so much,
Linkxgl