Movement issues (n00b question)

Okay, I’m a n00b at the BGE (I literally started experimenting with it less than a week ago), and I’m just messing around with it for now. Basically, I’ve got a little “level” with a ball rolling around. I’ve tweaked the ball’s movement so it looks really realistic, but it’s still got a problem.

I’ve got the movement set up so that when I hit up, it put force in the Y direction, when I hit right, it puts force in the x direction, etc. I’ve also got the camera set up so it’s locked onto the ball. Unfortunately, if the camera is turned 180 degrees, when I hit up, the ball moves down, if i hit left the ball moves right, etc. Basically the movement changes depending on the cameras view. More accurately, actually, the movement doesn’t change, but I need it to. I need a way for the ball to move in the correct direction local to the camera’s view.

I’m not very good with python, so I couldn’t come up with any scripts or anything…

Did that whole thing make sense? :confused: Thanks for any help.

Just to clarify, what I mean is that no matter which way the camera is viewing, the ball still moves along the global X & Y. I can’t make the movement local, because the ball rotates.

I need a way for the movement to be along the camera’s X & Y, basically.

Vertex Parent it. put a verticie in the middle of the ball and parent the camera to the center of the ball.

Let me try that…

Well, that does fix that problem, but now the camera automatically falls through the floor…
And if I get rid of my original camera logic brick, then it seems that the camera is too stiff; I wanted something more natural like the camera logic brick provides…

EDIT: I basically want to controls to be just like the controls in one of those rolling ball games. i.e. if I held down left or right I’d go in a circle, and up/down would make me go away from/toward the camera. If I start rolling away from the camera, it will follow.

Am I going to have to learn Python?

you need a bit … just a bit of python knowledge. The complication comes from what you want. You want the direction of motion to be driven by the camera’s orientation. So up is always forward in the camera perspective. So you’ll need to learn the command for getting the camera’s orientation. Then you’ll need to understand the elements of that matrix and how to adapt it to make it so the ball moves accordingly. Good luck. Its not impossible. Some python some knowledge of math/physics and you’re set.

Getting the camera orientation will let you KNOW which way the camera is facing, i.e which way the camer thinks is up. Then you’ll need to come up with a way to translate the logic bricks for motion that you have into python for the ball. that involves using your new up as a reference frame for all motion. I’ve never done this but thats the idea behind it.

Okay… So I guess I should learn a little bit of Python…
Sounds good though. Thanks!

Can someone point me to a tutorial or something on how to integrate python with blender? I know a little about Python by itself (the structure and stuff) but I’m clueless on how to use it with Blender.


The information you need can be found in the first few paragraphs of this tutorial, though I think you will find the entire thing useful.

Okay. Thanks a lot blendenzo!!