Help with setLinearVelocity?

Hi all. Could anyone explain how I can use setLinearVelocity to push a ball forward? I have the following code which creates and positions a cannon ball ballPlayer in front of a spatial avatarPlayer by 1.8f and above it by 1.8f. In the final line I try to push the ball forward in the direction the ball is facing, but seems the ball is not pushed forward but in some other direction. Any help is greatly appreciated!

ballPlayer = new Geometry(“cannon ball”, sphere);
ballPlayer.setMaterial(stone_mat);
rootNode.attachChild(ballPlayer);
ballPlayer.setLocalTranslation(avatarPlayer.localToWorld(new Vector3f(0, 0, 1.8f), null).add(0, 1.8f, 0)); // positions the ball relative to the
ball_phy = new RigidBodyControl(1f);
ballPlayer.addControl(ball_phy);
bulletAppState.getPhysicsSpace().add(ball_phy);
ball_phy.setLinearVelocity(ballPlayer.localToWorld(new Vector3f(0, 0, 1f), null)); // push the ball foward

Because ur not using a direction vector.

Here is a simple example of using physics:

http://code.google.com/p/jme-simple-examples/source/browse/#hg%2FJMESimpleExamples%2Fsrc%2Fcom%2Fspaceship

[video]http://www.youtube.com/watch?v=uvfu5SLugG8&feature=player_embedded#![/video]

In other words, I should put the following instead? I subtract the location that’s at 1 unit in front of the ball from the location of the ball?

ball_phy.setLinearVelocity(ballPlayer.localToWorld(new Vector3f(0, 0, 1f), null).subtract(ballPlayer.getLocalTranslation())); // push the ball foward

It seems a long way around.

Why not define your desired velocity somewhere and then apply the ballPlayers rotation to it?

Okay, I think I got it. I use the character control’s getViewDirection with setLinearVelocity. That should work!