Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 /
avatar image
0
Question by Spare_Liver · Nov 02, 2015 at 12:03 AM · cameramovementparticlesmath

Ideas for firing thrusters based on camera position in 3d a enviroment

So I am building a 3d lander type game. I am still fairly new to Unity.

I have set up a camera to orbit around my craft based on mouse input. I have also set it so that if i push my W key, my craft starts to gain momentum in the direction my camera is facing. However, if I move my camera along my orbit circle so that I am looking the exact opposite direction, and I press my W key, my craft will start to slow down, and then gain momentum again in the direction I am currently facing.

Here is my problem, I have a cone shaped lander that has 4 thrusters that fire along the X and Z axis. I want to fire the particle system based on the direction my camera is facing, so that my side-to-side movement, and my back-and-forth movement correspond to the thruster(s) that are firing. Any suggestions?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by HenryStrattonFW · Nov 06, 2015 at 03:40 PM

If i understand correctly what you want to do is Work out, based on the camera facing direction", which thrusters to fire to move in that direction.

If that's the case, then what I suggest is Dot Products. A dot product of two vectors gives you a value describing how similar those vectors are. For example two identical vectors in direction and magnitude, would produce a dot product of one. invert one of those vectors to point in the opposite direction, and the dot product becomes -1. Two vectors of the same size at 90 degrees would be 0, and so on.

Id suggest using a dot product between your cameras forward direction and the direction that each thruster is responsible for moving in. Then if the result is within a certain threshold, consider that thruster to be activated and trigger its effect accordingly.

You may want to play around with dot products to get a firm grip over what they do, and what results to expect, but that is the direction I would go If I've understood your question correctly.

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

38 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

Related Questions

Camera moving OnTriggerEnter 2 Answers

How do I make a camera controller where I can click and drag the world around, regardless of what angle the camera is at? 0 Answers

No smooth motion, Camera stutters 1 Answer

How to calculate next camera position to look at the object that changed rotation 1 Answer

Npc spawning outside the camera view and sliding down within the camera view 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