# Aircraft limit movement in trapezoid

 0 Hello, 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. more ▼ asked Jan 18 '11 at 11:31 PM Matthew 5 32 ● 10 ● 10 ● 12 A suggestion, not a solution: Can you make planes in to a trapazoid, and then just make the player fly in that? Then you can put a kinda enviroment texture on it? Jan 19 '11 at 12:03 AM Justin Warner add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

 0 You could use the Camera.ViewportToWorldPoint function to set up the bounds for the player. more ▼ answered Jan 19 '11 at 02:34 AM cjmarsh 373 ● 2 ● 9 Hello there, thanks for the post, but im not strong enough to understand how that command functions, the unity explaination confuses me Jan 24 '11 at 04:28 AM Matthew 5 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

By Email:

Topics:

x1371
x134
x25
x1

asked: Jan 18 '11 at 11:31 PM

Seen: 930 times

Last Updated: Jan 18 '11 at 11:31 PM