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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by AXXE78 · Jan 15, 2013 at 07:44 PM · orientationlinesvectrosityellipse

3D ellipse with Vectrosity

Hi, I'm trying to connect two 3D objects with a 3D ellipse using Vectrosity. I managed to get the correct size and position, but cannot find a way to orient the ellipse in the right way. This is the code I'm using:

 using UnityEngine;
 using System.Collections;
 using Vectrosity;
 
 
 public class TestCircle : MonoBehaviour 
 {
     public Transform obj1, obj2;
     private Vector3 origin;
     public float xRadius = 0;
     public float yRadius = 0;
     public int segments = 60;
     public float width = 5.0f;
     public float pointRotation = 0.0f;
     
     // Use this for initialization
     void Start () 
     {
         origin = (obj1.position + obj2.position) / 2;
         xRadius = Vector3.Distance(obj1.position, obj2.position) / 2;
         //yRadius = xRadius;
         Vector3[] linePoints = new Vector3[segments+1];
         
         VectorLine circle = new VectorLine("Circle", linePoints, null, width, LineType.Continuous, Joins.Weld);
         circle.MakeEllipse(origin, Vector3.forward, xRadius, yRadius, segments, pointRotation);
         circle.Draw3DAuto();
         
     }
 }

This is what I get now:

alt text

...and this is what I need:

alt text

Is there an easy way to orient the 3D ellipse that way?

Thanks.

schermata 2013-01-15 alle 20.38.22.png (50.1 kB)
schermata 2013-01-15 alle 20.43.14.png (34.4 kB)
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 Eric5h5 · Jan 15, 2013 at 07:58 PM

You'd want to change the up vector (which currently you have as Vector3.forward).

Comment
Add comment · Show 5 · 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 AXXE78 · Jan 15, 2013 at 08:03 PM 0
Share

Nope, I need it to be Vector3.forward, or it will be drawn flat on the ground grid (which is not wat I want).

avatar image Eric5h5 · Jan 15, 2013 at 08:15 PM 0
Share

Oh, I see...I misinterpreted your pictures. The easiest way would be to have an empty game object as a reference, and rotate that object in the desired way, and pass in that transform to the Draw3DAuto command.

avatar image AXXE78 · Jan 15, 2013 at 08:19 PM 0
Share

I should orient that empty game object, then; how can it be oriented along the distance between two arbitrary objects?

avatar image Ajes · Aug 25, 2014 at 01:21 PM 0
Share

hmm, my .Draw3DAuto(); can not take an transform? the only overload available is "float Time"

I can easily rotate my ellipse on X and Y axis, but not on the Z..

ellipse.$$anonymous$$akeEllipse((Vector3)origin, new Vector3(0,0,1), (float)xRadius, (float)yRadius, segments);

avatar image Ajes · Aug 25, 2014 at 01:32 PM 0
Share

well, I found a semi-solution that helped a little, I used:

ellipse.vectorObject.transform.RotateAround((Vector3)origin, Vector3.forward, 150f);

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Trouble again with 3D ellipse {FIXED} 1 Answer

Need the user to be able to draw lines on the screen. 1 Answer

Draw lines with Vectrosity in the direction transform.forward 1 Answer

Vectrosity lines being distorted when rotated 0 Answers

What is the best way to draw a border around a viewport? 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