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 /
avatar image
0
Question by Doctor06 · Jan 24, 2017 at 07:38 AM · cameraspaceorbit

Camera Orbit for spaceship

There is a lot of help for orbital cameras. And the best one if of course provided by unity wiki MouseOrbitImproved.

I am trying to use this script for a spaceship that can also rotate on its z axis.

This is is how i have my objects set up.

-Spaceship

-FlyCam(GameObject)

--FlyCamera(Camera)

The FlyCamera has a script that tells the parent FlyCam to follow the spaceship if the spaceship moves.

I added the MouseOrbitImproved script to FlyCamera and on start it is disabled. If I press and hold Left Control, I can orbit the spaceship. When I release Left Control, x and y get reset back to 0. Everything works well if I fly in a straight line and the script is active. If I let got of Left Control and change my y or z axis, and activate the script, the camera still orbits the object, but not using the correct axis.

Initially, This is what it looks like if I fly in a straight line and I don't change direction. alt text

I can activate the orbit script and it will orbit correctly. Now if I disable and I continue to fly, but this time I change direction and go straight up 90 degrees. If I activate the orbit script, it will look like this. alt text

This is not how it should be though, it should be like in the first image.

Is there any way I can always keep the orbital camera behind the spaceship like in the first image every time i activate the script?

If there is any resource I may have missed that already answers this question, I'm sorry. I tried to search before I asked, but i could not find a solution that involved the z axis. they all deal with only x and y axis assuming the object's y axis is always up.

Any help would be appreciated. Thank you in advance.

screen-shot-2017-01-24-at-9-08.png (356.5 kB)
screen-shot-2017-01-24-at-9-09.png (448.7 kB)
Comment
Add comment · Show 4
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 Peaj · Jan 24, 2017 at 12:38 PM 0
Share

So you want to use the spaceships up axis as the axis to rotate around ins$$anonymous$$d of the world up axis? So the camera will also look up if its behind a spaceship facing upwards?

avatar image Doctor06 Peaj · Jan 24, 2017 at 03:13 PM 0
Share

Yes, exactly. That's why I have the FlyCam game object as a parent of FlyCamera. so its position and rotation remains zero, and FlyCam is the one that changes rotation and position as the spaceship rotates or moves. The Orbit is attached to the child of FlyCam, the one that is Zero for position and rotation, so I don't see why it would not work, but for some reason, the child is taking into account its parent rotation.

avatar image Peaj · Jan 25, 2017 at 11:53 AM 0
Share

Do you only set the position of the FlyCam Object or also the rotation? Bacause if you dont set the rotation the orientation will stay the same and thus the y-axis will still be pointing upwards in worldspace.

avatar image Doctor06 Peaj · Jan 25, 2017 at 03:18 PM 0
Share

Once the script is deactivated, then all rotation and position is reset for FlyCam object back to be behind the spaceship.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Doctor06 · Jan 27, 2017 at 12:55 AM

For those of you who find this question. I'll redirect you to where i found a good solution to the question.

How to make camera rotation relative to target.

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

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Enable the OrbitCam script how can I make it will continue from the current camera view and position ? 0 Answers

Moving player in direciton camera is facing 1 Answer

Space Combat Simulator - Camera and Thrust/Roll 1 Answer

Camera Orbit Script Error 3 Answers

Camera Orbit Rotation Problem 0 Answers


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