Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
This question was closed May 17, 2017 at 12:51 AM by Yuzuke for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by Yuzuke · May 16, 2017 at 04:00 AM · androidcameraparticle system

Particle system displacement caused by Android camera switching

I'm doing an android APP, and I came across a button that swap the android device camera back and forth : - when the device use its back camera( CAMERA_BACK,CAMERA_DEFAULT ), the particle system works as intended. - when it change to front camera( CAMERA_FRONT ), the UI flipped horizontally so I have to manually flip it back...... AND the particle system went all wrong , it turn itself upside-down and the position is all messed up. I tried to manually flip particle system as I did to UI but it went worse, the result is totally unpredictable. I believe it not only flips but also rotates. so... HELP ~~~~PLZ~~~~~~OTZ~~~~

screenshots: alt text

alt text

1.jpg (389.0 kB)
2.jpg (342.2 kB)
Comment
Add comment · Show 13
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 ifurkend · May 16, 2017 at 04:53 AM 0
Share

You're not supposed to flip the UI manually which only complicates things. If you're using the built-in canvas UI, change back to "Screen Space - Overlay" or use a dedicated camera only renders the UI layer if you insist "Screen Space - Camera" (subsequently remove the UI layer from other cameras' culling mask). If you're using NGUI then I have little knowledge about it.

avatar image Yuzuke ifurkend · May 16, 2017 at 05:02 AM 0
Share

thanks your comment ! but I tried "Screen Space - Overlay" too, and then the firework effect is too tiny to visualize.

avatar image ifurkend · May 16, 2017 at 05:12 AM 0
Share

Then move the camera closer to the fireworks if it's perspective projection or change camera "size" if it's orthographic.

avatar image Yuzuke ifurkend · May 16, 2017 at 05:46 AM 0
Share

I check back and found I didn't flip the UI ( maybe I did that last build ), but the fireworks is still upside down... the whole function is now like this: alt text

just simple camera-switching. nothing more.

and the setup: alt text

qq截图20170516134646.png (8.2 kB)
qq截图20170516134851.png (106.7 kB)
avatar image ifurkend · May 16, 2017 at 06:12 AM 0
Share

Perhaps you can record a video of your editor to show both the scene view and game view. If the fireworks appear upright in scene view, the only problem could only be the rotation of your camera.

avatar image Yuzuke ifurkend · May 16, 2017 at 06:29 AM 0
Share

thanks as always, and what do you mean by "rotation of the camera" ? all I did is switch back and forth. and I can't record a video cuz I have no android simulator or sth., all I can do is test my APP in the Android device that connected to my PC. so obviously when I enter play mode in Unity, the camera won't turn back and forth( cuz it doesn't have any ) and the fireworks looks great!

avatar image ifurkend · May 16, 2017 at 06:45 AM 0
Share

Then you may parent the whole effect object under the camera so it's always upright.

avatar image Yuzuke ifurkend · May 16, 2017 at 07:03 AM 0
Share

parent the whole effect object under the camera

I've tried. no. still hanging there. upside-down, mocking my patient.

avatar image Yuzuke Yuzuke · May 16, 2017 at 07:07 AM 0
Share

it's all about Android's " CA$$anonymous$$ERA_FRONT " I think. everything is fine in CA$$anonymous$$ERA_BAC$$anonymous$$, even when I change from front to back, the particle will appear normal again too. I started to wonder maybe there's some built-in mechanisms in android platform or sth.

avatar image ifurkend · May 16, 2017 at 07:20 AM 0
Share

Sorry I forgot to add that about the parenting method: If you find that the simulation space of the main/velocity/force modules are "world", change them to "local", but you do need to do some extra work (switching values between x/y/z axis) to ensure the fireworks are still upright in the scene view. And then you test it by rotating the camera upside down in the editor to emulate the scenario in the phone.

avatar image Yuzuke ifurkend · May 16, 2017 at 07:36 AM 0
Share

I hate to say that I've tried this too... it's not working, even custom and bind a transform to them, no. that's why I went crazy and came here for help..

avatar image Yuzuke ifurkend · May 16, 2017 at 07:39 AM 0
Share

all I can think about is make every firework animation depends totally on gravity, and manually negate the gravity when camera switches, I'll go for this now wish me luck... or..

Show more comments

2 Replies

  • Sort: 
avatar image
1
Best Answer

Answer by ifurkend · May 16, 2017 at 09:54 AM

It's a lesson for me as well. The unity camera which renders what the camera in reality captures serve as the base camera (lowest depth) without rendering other scene objects, otherwise things will rotate unexpectedly. Then create another camera with "depth only" clear flag and higher depth value for rendering the rest of scene objects.

Comment
Add comment · 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
0

Answer by Yuzuke · May 16, 2017 at 07:53 AM

Or you use "Screen Space - Camera" mode in UI canvas and add a separate UI camera which only renders UI layer (and remember to remove "UI" layer from your AR camera), then change the layer of all firework objects to "UI", effectively making all the firework particle systems part of the UI elements.

@ifurkend I'm not sure if I already did this but I'll do this now. thanks for your patient.

Comment
Add comment · Show 6 · 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 Yuzuke · May 16, 2017 at 08:14 AM 0
Share

@ifurkend but the fireworks is supposed to overlay on the AR images, how can I do this if I use 2 cam to separate those.. I don't quite get it.

avatar image ifurkend Yuzuke · May 16, 2017 at 08:19 AM 0
Share

The final rendering result automatically combines all effective cameras. The order or rendering depends on the "depth" value in the camera component, the greater depth of the camera, its objects will appear before others rendered by camera with lower depth value. As long as you don't rotate the UI camera (or let other script rotate it), the fireworks rendered by this camera should remain upright.

avatar image Yuzuke ifurkend · May 16, 2017 at 08:54 AM 0
Share

@ifurkend IT WOR$$anonymous$$ED!! , the firework's no longer upside-down. HURRRRAY!!!!!!!!!!!! BUT the only problem now is the UI Camera's setting. cuz now it only shows black screen. and the UI elements and the fireworks. ID$$anonymous$$ whats wrong but I cant upload images right now, so:

for the clearflag I use solid color and make it totally black, also set the alpha to 0 as ARCam currently has, and I use orthographic projection, and for the culling mask: ARCam is everything except UI, UICam is everything( or UI only it makes no difference to me, all black )? and the rest of the setting just default. and also depth is fixed, 0 for ARCA$$anonymous$$ to stay behind, 1 for UICam to overlay up top.

where went wrong? what am I missing?

Show more comments

Follow this Question

Answers Answers and Comments

186 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Particle System not showing up in game view, showing up in scene view 13 Answers

can i find whats the problem of the script of free camera rotation ?? 1 Answer

Particles invisible in bottom half of game viewport 0 Answers

How to use External camera on andorid 0 Answers

How to move camera with Input.GetAxis() and my camera view direction?!! 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