2d effects with 3d graphics

Im pretty new to the bge and iv been trying to figure out how to make a game with 3d graphics but only moving in 2d space. I want my game to be like the game hammerfall http://www.youtube.com/watch?v=Gfjj6WcP3m8. And the problem is that when I move around my ship with the weapon attached to it it gets all out of whack and spins out of 2d space. So basically i need a way to limit my objects movement and rotation to the x and y axis any help would be much appreciated.

Use a constraint actuator, that way you can force an object to always be 0 (or whatever) on the Z axis.

I was doing some 2d stuff and used setPostition() to always set my player to 0 on the Y-axis. I also use the alignAxisToVect() function to constantly point one axis toward the camera. I find it’s much more flexible than using trackTo actuators.

That’s true, if your object already has a control script it’s probably more logical to use setPosition instead of a constraint. Less messy, at any rate.

I use both methods in my game :stuck_out_tongue: but I have some messy parenting and unparenting going on, and constraint doesn’t work well with that, since there is no way to disable them ingame afaik.

thanks guys the constraint actuator sounds like the way to go. the other way sounds good bud I dont know how to program in python so… thnks for help though

None of that is needed. Just make sure the camera for the player is set to orthographic. Heres an example.

Attachments

2deffect.blend (42.6 KB)

setting the camera to orthographic doesn’t change anything- objects can still leave the plane they should be sitting on. For example, in your file turn physics on (because this whole problem is based around using physics) and move the cube off the edge of the ground.

I cant get the constraint to work I put an attachment of an example that i need fixed. If someone could change that file (using logic bricks no python) so that the object cannot spin other than on the x and y axis and can also not move on the z axis. This would be very appreciated.

Attachments

example.blend (126 KB)

Try this bit of python, connected to an Always sensor:

import GameLogic as g
cont = g.getCurrentController()
own = cont.getOwner()
[x,y,z] = own.getPosition()

#point z-axis up at all times
own.alignAxisToVect([0,0,1],2)

#set z-position to zero
own.setPosition([x,y,0])

thank you very much that was exactly what i needed. plus its simple enough I can modify it myself. thank you very much skullbunny.