# How to lock the mobile axis

## How to lock the mobile axis

If I want to make a game, the z axis no mobile, like the trine 2. What could I do with Havok?

6 posts / 0 new
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

You do not necessarily need to do anything special with Havok to accomplish this.A side-scrolling game like this is basically just a camera trick - keep the camera look direction fixed along the Z axis. Then you can just place all your objects with Z=0, and do all your game play logic on the XY plane.

If you do happen to run in to some cases where things unexpectantly move along the Z axis (eg. two objects collide and then bounce away along the Z axis or rotate along the X or Y axes) then you could use constraints and special inertia tensors to fix the linear and angular movement to the XY plane.
APointToPlaneConstraint can be used to fix objects' linear movement to an XY plane, and you can modify their inertias to limit rotation to the Z axis. However, I would not worry about this too much unless you run into specific problems with things moving/rotating unexpectantly.

There is actually already a good post on this you might want to check out:

Cheers,
Tyler

I also want to know could createpoint to curved surface constraint, because the character not just in a plane move.

I'm not sure I understand what you mean by a point to curved surface constraint. There is not a built-in constraint that acts like this. However, if the character is not limited to the XY plane then it's probably best to just let things move freely on all axes. I recommend trying a constraint-free approach first and then see if there are any specific issues.

Cheers,
Tyler

As shown below. The objects move in the curved surface, how to create a constraint do this?

I'm afraid I still do not quite understand how this would work. This seems like something best suited for game logic though instead a physics constraint. If you want your character to run in/out of the Z axis as they move across the screen you could just change their velocity to wave based on the X position.

-Tyler