The ball won't head in the rotated direction/camera won't work with it

After months of frustration, I’m about to give up on this…

I’m using logic bricks at the moment, but willing to use python if necessary.

Here’s my dilemma:

I’m just making a simple ball-rolling game, and I got the ball to move on the x and y axis, but I’m looking for less restrictive movement. It would be so that you could turn the ball (rotate it on the z axis) left and right, and when the forward keyboard control was pressed, it would move in the direction of the “front” of the ball, so it could move diagonally instead of just “up-down-left-right”. I managed to get it to rotate like that, but can’t get it to actually move in the same direction. If this is confusing, please let me know and I will try to elaborate further.

Another thing is that when the ball “turns”, the camera doesn’t do the same and always follow the back end of the ball. I’ve tried parenting the camera to the ball, parenting it to an empty which was then parented to the ball, and vertex parenting…none of which worked. Perhaps I’ve done it incorrectly, but it doesn’t seem to be the case.

Of course, if I don’t need the ball to actually roll and rotate in such a manner, it would be significantly easier…but that’s defeating the point.

Any suggestions?

check this out,

Attachments

cameraDependantControls (1).blend (574 KB)

now about “in betweens”

if keypress A (True)-------and----motion(left)
if keypress W (False)-----/

if keypress A (True)-------and----motion2(upleft)
if keypress W (True)-----/

if keypress A (False)-------and----motion3(UP)
if keypress W (True)-----/

etc

Hmm, this is much more complex than I had imagined…but it works, I guess. Are the cubes there to detect the movement on the default plane to correct the trajectory and make diagonal movement possible (a very terrible guess)? I’m not quite sure how it works…which would probably be better than just copy pasting it as I’ve found out from experience.

Also, how would the camera work with all of this then?

rotate the camera with Q and E

the cubes are targets that the ball applies force to,

Ball gets vector to box -> applies force in line with box,

but the trick is the boexs , they move with the ball, and are aligned with the camera,

So this is a 100% using physics method ,

WSAD always work

W----and------set target “W cube”

My controls don’t change when the camera rotates,

ahh I see neither will yours, I think?

also, you can feed my ball a target :smiley:

Ahh, thank you so much Phil! The first example was exactly what I was looking for.

Thanks Blue for trying to help too!