I'm building a basic flying game, the camera is static and the aircraft is controlled with WASD.
There is no physics bar Rigibody for the bullets and colliders.
The camera is Perspective.
I've used this code to prevent the aircraft moving out of screen;
if ( transform.position.x > PlayerOriginPos.x + MovementLimit )
transform.position.x = PlayerOriginPos.x + MovementLimit;
if ( transform.position.x < PlayerOriginPos.x - MovementLimit )
transform.position.x = PlayerOriginPos.x - MovementLimit;
if ( transform.position.z > PlayerOriginPos.z + MovementLimitForward )
transform.position.z = PlayerOriginPos.z + MovementLimitForward;
if ( transform.position.z < PlayerOriginPos.z - MovementLimitBack )
transform.position.z = PlayerOriginPos.z - MovementLimitBack;
Though because of the cameras field, i require the area of movement limit to be a upside down trapezoid, i gather it requires math, but i have no idea how to go about this?
Any help would be great, thank you.
Jan 18 '11 at 11:31 PM