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 Fr0stbite · Jun 01, 2014 at 03:33 PM · vector3scaleplanecoverregion

Resize Plane?

picture

is is possible to resize the plane to the distance of two sphere. I hope you can understand me. The left downer corner to the left sphere the right upper to the right spehere.Like a selection box. I want to cover with the plane an entire region with two Vector3

névtelen.jpg (78.5 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 thornekey · Jun 01, 2014 at 03:37 PM 0
Share

yes, although it would probably require a raycast

avatar image Fr0stbite · Jun 01, 2014 at 03:50 PM 0
Share

so it it isn't possible without raycast?

1 Reply

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

Answer by zharik86 · Jun 01, 2014 at 07:11 PM

Yes, of course, probably. It is the simple geometrical task. But at first the "correct" plane is necessary to us. (scale on guides equal 1 will give the size 1x1 in a world). It is possible to create the plane in 3dmax and to import. If isn't present, instead of the plane it is necessary to take a standard cube and, for example, scale on a y axis to make equal 0.1 or less. So, we have all necessary, now a small code(write on CSharp):

  public Transform sphere1 = null; //our sphere number 1
  publuc Transform sphere2 = null; //our sphere number 2

  void Start() {
   //if you scale your plane in xz, then
   Vector3 pos1 = sphere1.position;
   Vector3 pos2 = sphere2.position;
   pos1.y = this.transform.position.y;
   pos2.y = this.transform.position.y;
   //Sets new position of our plane
   this.transform.position = 0.5f * (pos1 + pos2);
   //Calculate new scale for plane
   float scaleX = Mathf.Abs(pos1.x - pos2.x);
   float scaleY = this.transform.localScale.y;
   float scaleZ = Mathf.Abs(pos1.z - pos2.z);
   this.transform.localScale = new Vector3(scaleX, scaleY, scaleZ);
  }

And attach this script to your plane.

Comment
Add comment · Show 1 · 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 Fr0stbite · Jun 02, 2014 at 02:20 PM 0
Share

Thank you!

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

23 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

Related Questions

How to align the bottom of a GameObject with the ground? 1 Answer

why the real size of a object doesn't show in the inspector? 0 Answers

Scale mesh between two Vectors 1 Answer

Projecting a point on plane 1 Answer

How to Rotate Plane of Cube Around its Center? (Rotate Vectors Around Point/Axis/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