Stop RigidbodyControl

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?

With such special requirements, why use physics at all?

Maybe to move other object that collide with his ball ?

Anyway : just do your piece of code every physics tick, not every frame tick (the physics engine can be faster than the frame rate).

@bubuche said: Maybe to move other object that collide with his ball ?

Anyway : just do your piece of code every physics tick, not every frame tick (the physics engine can be faster than the frame rate).

Then he should just use kinematic mode.

1 Like