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 TurboHermit · Apr 23, 2012 at 12:29 PM · objectlookattargetz

Object as far Z as it can

I've thought of a targeting system, in which an object is in the center of the camera. All bullets face that object when instantiated... Now what I'd like to know and can't find anywhere is how to make this object instantly go as far z as it can before colliding with something. How would I achieve this?

Comment
Add comment · Show 8
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 Kryptos · Apr 23, 2012 at 12:36 PM 1
Share

Raycast?

avatar image TurboHermit · Apr 23, 2012 at 03:06 PM 0
Share

Well I get that much, I'm currently using a raycast to see if there's anything in front of it... But how do I make it 'stick' to the object it detects?

avatar image Kryptos · Apr 23, 2012 at 03:13 PM 0
Share

Well. With the raycast you get the collider that was hit. You can then put the object at the collision point $$anonymous$$us the extents of both objects along the normal of the collision point.

See RaycastHit, Collider.bounds

avatar image TurboHermit · Apr 23, 2012 at 03:23 PM 0
Share

Well I don't have to align it to the normal cause it doesn't really have to 'stick', it's objects z position just needs to be at the collision point. I've tried hit.distance and hit.point.z already, hit being the RaycastHit, but this doesn't seem to get the wanted effect.

avatar image Kryptos · Apr 23, 2012 at 03:39 PM 1
Share

Do some drawings or diagrams of what you want, because I don't get it. Sorry.

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Ease in transform.LookAt() - keep other target within camera boundaries 1 Answer

How to make an object to look at Raycast Hit Point? 1 Answer

How to change use transform.LookAt to make the bottom of an object look at something? 0 Answers

Target distance would only update closer 1 Answer

Decrease distance between 2 objects 3 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