I'm terrible at math and it is already quite late so could someone point me to the right direction with this.

Actually not object but screen center

So for short I would like to restrict camera from going over that line (scrollx,scrolly)

7 posts
• Page **1** of **1**

I'm terrible at math and it is already quite late so could someone point me to the right direction with this.

Actually not object but screen center

So for short I would like to restrict camera from going over that line (scrollx,scrolly)

Actually not object but screen center

So for short I would like to restrict camera from going over that line (scrollx,scrolly)

Last edited by Katala on Sat Feb 22, 2014 11:30 am, edited 1 time in total.

**Posts:**517**Reputation:**5,206

B

34
S

9
G

3
What is the effect you are trying to achieve? I don't think I have a clear view, because there is the scroll to behavior which to me sounds the same thing: the camera never leaving the center point.

Could you explain exactly what it is you're trying to accomplish? Like the final goal that is?

Could you explain exactly what it is you're trying to accomplish? Like the final goal that is?

**Posts:**262**Reputation:**3,690

B

25
S

6
G

6
I'm making two assumptions here:

1) you want the camera to operate solely within the lower triangular area.

2) Your Layout is in 16:9 aspect ratio eg 960X540 **

using trigonometry:

Calculate the diagonal angle to be: 29.358 (trust me) we'll call this 'a'

from that we can use the tangent of the X value to set the Y value to draw the hypotenuse (your diag line)thus:

Y=X*tan(a)

So to fall within the triangular area you want the coordinates must be in the range:

camera.Y>camera.X*(0.5625) {0.5625 == tan 29.358}

So the short answer is:

camera.Y>camera.X*0.5625

Hope this makes it easier.

** Adjust the angle if different aspect ratio

1) you want the camera to operate solely within the lower triangular area.

2) Your Layout is in 16:9 aspect ratio eg 960X540 **

using trigonometry:

Calculate the diagonal angle to be: 29.358 (trust me) we'll call this 'a'

from that we can use the tangent of the X value to set the Y value to draw the hypotenuse (your diag line)thus:

Y=X*tan(a)

So to fall within the triangular area you want the coordinates must be in the range:

camera.Y>camera.X*(0.5625) {0.5625 == tan 29.358}

So the short answer is:

camera.Y>camera.X*0.5625

Hope this makes it easier.

** Adjust the angle if different aspect ratio

**Posts:**93**Reputation:**797

B

7
S

2
7 posts
• Page **1** of **1**

## Who is online |

Users browsing this forum: No registered users and 10 guests |