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
1
Question by Benjames · Jan 17, 2016 at 09:03 PM · camerarotationquaternionvelocity

Camera.WorldToScreenPoint Equivalent

So I have a number of Objects on a sphere with unique rotations. Each object have a Vector2 velocity that determines its direction and movement around the sphere My code is based off this post: http://answers.unity3d.com/questions/41050/how-can-i-make-movement-on-a-sphere.html So I want my objects to bounce off each other semi realisticly the math behind this has me stumped

One thing that gets very close to working is taking the screen position of the object the camera is attached to and the screen position of the other object colliding, then getting the angle between the two screen positions and changing the velocity to the Cosine and Sine of that angle.

BUT.. not every object can have a camera because its severely inefficient.

So my question is how could I use just math to accomplish the same effect of Camera.WorldToScreenPoint?

alt text

screeennshot.png (152.4 kB)
Comment
Add comment · Show 2
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 Benjames · Jan 17, 2016 at 09:46 PM 0
Share

It may not be so inefficient as I think if I don't render anything on the camera. But it might be. Who knows? Still if you have a solution it would be much appreciated because I want to make this game for mobile and every optimization counts.

avatar image Benjames · Feb 05, 2016 at 07:38 PM 0
Share

A buddy of $$anonymous$$e pointed out that the play-field and type is very similar to Super Stardust for Playstation 3. That game looks pretty sweet, I havn't played it but I watched a couple videos on Youtube. The asteroid co$$anonymous$$g in from the side and breaking apart on the play-field is amazing to me. Perhaps that game will be my inspiration for now. It almost looks like the asteroids are $$anonymous$$arching Cubes, I'll have to look into implementing some sort of procedurally generated asteroids myself. But first I better figure out a more efficient way to have collisions happen naturally on the sphere shape play-field.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by cjdev · Jan 18, 2016 at 12:42 AM

The way that method works is by multiplying matrices together, specifically the model, view, and projection matrices (MVP). This is done quite often in the GPU by OpenGL or DirectX, just about every frame for every pixel actually, so it's a fairly common problem to solve. I would give you some example code but honestly I get a headache every time I see a matrix. There's a good answer here that might get you started though.

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

43 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

Related Questions

Quaternion - Euler Angles, weird variable swapping when converting 2 Answers

Rotating a GameObject based on another GameObject's y-axis 1 Answer

Rotation based on Velocity returning 0,0,0 rotation 1 Answer

Gameobject Rotation Calculation 0 Answers

How to add a rotation to this? 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