Hey guys,
i have an sphere, which can move over the hole world. But this Sphere is only to allowed to move in one direction. This mean this sphere is allowed to move either in +Z direction or in + X direction. And not a little bit of both…
I tried somethin like this
[java] if (x >= y) {
// move on x axis
if (temp.getX() > 0) {
// right
playerControl.setLinearVelocity(new Vector3f(10, 0,
0));
} else {
// left
playerControl.setLinearVelocity(new Vector3f(-10,
0, 0));
}
} else {
// move on y axis
if (temp.getY() > 0) {
// forward
playerControl.setLinearVelocity(new Vector3f(0, 0,
-10));
} else {
// backward
playerControl.setLinearVelocity(new Vector3f(0, 0,
10));
}
}[/java]
Sometimes the sphere dont move vertical or horizontal only… Some ideas?