Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Lacrymology · May 05, 2011 at 08:38 PM · camera-movementlimitisometric

Isometric game camera limits

I'm trying to set the limits for the camera of an isometric game I'm trying to make. The problem I'm having right now is that my world objects are placed with 0 rotation made to fit on whole number coordinates on the world, but the camera is rotated 45 to get the classic "sim city" view.

The thing is that I'm checking the limits with a simple 3 component clamp on max and min 3D values, which means that the world "walls" are oblique to the camera view, i.e., the camera can move on a rhombus, not a straight rectangle... is there a way to be able to set up the limits so they work relative to the camera's rotation?

edit: I made this simple diagram:

isometric view diagram http://imgur.com/N3TTp

the red square are the limits, they go from -10,-10 to 20,20 in (x,z), but the camera view is oblique, it looks at it diagonally, like a standard sims-like view. I need my world limits to be not the square that goes from -10,-10 to 20,20 in world coordinates, but the one that goes from -10,-10 to 20,20, in a 45 rotated world, so the camera behaves like this:

wanted behavior http://imgur.com/Q8ozm

where the brown is the floor, and the red is the camera limits

is this clearer?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

4 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by NewfieJoe · May 06, 2011 at 12:19 AM

If the camera is rotated at n odd angle and shifting by transform throws it off, make it the child of an empty GameObject aligned to your constraining rectangle and use that as a handle to move it. You can also cheat the constraints by placing it in an offscreen volume and using collision detection to stop it from moving out of bounds if the constraints are an irregular shape. ;)

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Lacrymology · May 06, 2011 at 03:42 PM 0
Share

I tried to do this, but used rigidbodies, and that was just too messy, the camera would bounce against the borders ins$$anonymous$$d of just stopping, I COULD turn off the physics and do a complicated collision detection or an ugly labeling of the walls to know which direction I'm supposed to stop it from moving, but I think this is ridiculous if what I want to do is to clamp it to a rectangle

avatar image flaviusxvii · May 06, 2011 at 04:08 PM 0
Share

You're falling into the trap of presenting a "solution" you came up with as a problem, and you're asking how to solve it. You're asking us for a solution to a solution, and you don't even know if it's a solution at all. Forget what you think you know or how you think things should work. Describe your PROBLE$$anonymous$$ and maybe someone will know how to solve it.

avatar image Lacrymology · May 06, 2011 at 06:27 PM 0
Share

I'd upvote your comment. You're absolutely right. Anyways, I realized that if this was a simple problem, we wouldn't need AA.BBs, so I think the elegant solution is to straighten up the camera, and rotate the rest of the world

avatar image
-1

Answer by flaviusxvii · May 05, 2011 at 08:49 PM

Can you draw a picture of what you're talking about and post it on imgur.com and paste a link. I would think you'd want the camera to only look at the rhombus, which it sounds like you have. I don't know what you mean by a 'straight rectangle'. Straight with respect to the forward direction of the camera? Wouldn't that allow you to view things that are out of bounds?

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Lacrymology · May 06, 2011 at 03:38 PM 0
Share

yes, I want it to look at the rhombus, but its movements to be limited by a rectangle straight to the forward direction of the camera. This WOULD allow me to view stuff out of the borders, but since my level's shape's a cross anyways, this is quite hard to avoid anyways

avatar image
0

Answer by Henrique Vilela · May 05, 2011 at 08:54 PM

The way you move the camera are not supposed to be affected by the camera rotation, so the clamp approach should work keeping the camera on a squared limit. The unique difference is that your limit square is not the same as your stage, you need to offset it based on your camera angle and distance from the floor.

Lets say your objects are placed from 0,0 to 100,100. Your camera will be limited by (f.e.) 25,25 to 125,125. The 25 offset is just a guess, the value will depend on your camera's angle and floor distance.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Lacrymology · May 06, 2011 at 03:39 PM 0
Share

no, I figured that part out. What I want is precisely to clamp the camera to a rectangle rotated in the same way as the camera

avatar image
0

Answer by MiguelDeLaCruz · May 05, 2011 at 09:04 PM

you could use the camera's transform.

transform.position += transform.right * Time.deltaTime;

That would move it to its right based on it's rotation.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MiguelDeLaCruz · May 05, 2011 at 09:06 PM 0
Share

Thought I could be missing some detail.

avatar image Lacrymology · May 06, 2011 at 03:39 PM 0
Share

This I'm doing, and it's working fine, the problem is not with movement, but with the clamping

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

3D Isometric Camera rotate around player and follow 1 Answer

Forward and back movements with a camera emulating an isometric view 1 Answer

Isometric camera movement 1 Answer

i need to use the rotation value of the x axis on a camera 1 Answer

Isometric - Camera follow an object when at the edge of the screen 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges