1
$\begingroup$

I'm making a game and I'm using logic bricks to make my character (currently a default cube) move.

It moves (using the arrow keys) relatively fine up until I try to go down a slope or fall off an edge of some kind. When I try to fall instead of falling down as soon as goes off an edge, it keeps going in the same direction until I release the arrow key making it move.

And something even weirder is that if the object is still in the air after it starts falling when the arrow key is released, if you press the arrow key again it causes the object to completely ignore gravity again and go off in that one direction.

If you need anything to help you solve this problem I'll provide what I can. I'm using blender's game engine if that helps.

EDIT: Turns out its falling really slowly instead of staying the same height. It's still annoying though.

Hope you can help. Jako

$\endgroup$
  • $\begingroup$ Are you using character physics, rigid body physics, or dynamic physics fr your character? (Also, are you using regular motion to move the character, or are you controlling the linear velocity?) $\endgroup$ – X-27 the fluffy unicorn Dec 12 '16 at 0:50
2
$\begingroup$

Gravity forces

You need to be aware that gravity is a force. This force will be applied to the current linear velocity.

The linear velocity gets increased over time as you add the force again and again, resulting in a larger linear velocity.

Therefore you get:

linear velocity = previous linear velocity + velocity from gravity

which is:

linear velocity = initial velocity + velocity from gravity + velocity from gravity + ... 

Situation

I assume you explicitly set the linear velocity on key press.

In this case the final linear velocity will not add up as you already reset it as reaction on the key press.

The result is:

linear velocity = motion velocity + velocity from gravity

The gravity can't simply add up.

Possible Solutions

Motion as force

When you apply the motion as force your motion force will not override the previous linear velocity. It will be added the same way as the gravity force will be added.

This allows smooth but unlimited acceleration.

Servo Control

The motion mode "Servo Control" allows to setup a linear velocity without overriding certain axis. I suggest to enable the [Z] button and leave the limits at 0.0 as they initially are.

This allows the object to fall down without accelerating into the direction you want it to move.

$\endgroup$
0
$\begingroup$

You need to set your units to imperial or metric (or whatever you want for that matter).

$\endgroup$
  • 1
    $\begingroup$ Hi. Would be useful if you added where those options are. $\endgroup$ – Ray Mairlot Dec 15 '18 at 16:05

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.