Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - kalid360

Pages: [1]
1
Support / Re: Clamping Camera based on viewport
« on: October 31, 2013, 03:03:57 pm »
it works!
Thanks a lot!

2
Support / Re: Clamping Camera based on viewport
« on: October 30, 2013, 11:07:40 pm »
Ok I took a look at that function and ScreenExtents.width again but I'm still not understanding.

When I divide my anchor transform by half and the camera transform but that doesn't give me expected results with different screen res/ratios.
I also applied the  tk2dCameraAnchor to the border, the anchoring works great but my math is still wrong.

float begin =  transform.position.x + beginBorderTransform.position.x / 2;
float end = transform.position.x + endBorderTransform.position.x / 2;

transform.position = new Vector3(Mathf.Clamp(transform.position.x, begin, end), transform.position.y,transform.position.z);

What am I missing?

3
Support / Re: Clamping Camera based on viewport
« on: October 30, 2013, 08:01:27 pm »
What do you mean? How would I use that on deciding how much to constrain by?
I'm a little confused.

4
Support / Clamping Camera based on viewport
« on: October 30, 2013, 06:48:56 pm »
I'm having issues constraining my main camera in the game. This camera follows the character around.
I need it to clamp from the beginning to the beginning to the end of the game, resolution/aspect ratio independent.
Right now I have fixed numbers clamping the camera, which isn't good because it doesn't work well across multiple displays.

transform.position =  new Vector3(Mathf.Clamp(transform.position.x, leftOffset, rightOffset), transform.position.y, transform.position.z);

I also tried using empty game objects and that didn't work either.

I currently have a wildcard on my 2D toolkit camera (if that helps):
Match by: wildcard
Autoscale: Fit to height
Fit mode: Center

Any help would be much appreciated!

Pages: [1]