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 jwinn · Oct 12, 2012 at 06:34 AM · mousegui.labelvectrosity

How to stop lag between Vectrosity circle and GUI.Label at mouse cursor?

I am using Vectrosity to draw a circle at the mouse location, and then would like to draw text in the center of it. I'm using GUI.Label to draw the text. The problem is that the Vectrosity circle is lagging behind the GUI.Label when the mouse is moving. The faster you move it, the more it's off; to the point of being outside the circle. How do I make sure that these are in the same location? Note that this also happens when using "Input.mousePosition" rather than "Event.current.mousePosition".

Here's a simplified example, and a screenshot of what I see:

alt text

 using UnityEngine;
 using System.Collections;
 using Vectrosity;
 
 public class TestMouse : MonoBehaviour {
     
     private VectorLine rings;
     
     // START
     void Start()
     {
         // Vectrosity Lines & Points; Drawn later with MakeCircle
         rings = new VectorLine("Ring1", new Vector2[32], Color.white, null, 4, LineType.Continuous);
     }
 
     // GUI
     void OnGUI () 
     {            
         float mousex = Event.current.mousePosition.x;
         float mousey = Event.current.mousePosition.y;
         
         // Ring
         rings.MakeCircle(new Vector2(mousex, Screen.height - mousey), 30);
         rings.Draw();
         
         // Draw text
         Vector2 textSize = GUI.skin.label.CalcSize(new GUIContent("Test"));
         GUI.Label ( new Rect(
             mousex - (textSize.x / 2), 
             (mousey - 15), 
             textSize.x, 
             20), 
             "Test"
         );
     }
 }
 


vectrosity_lag.jpg (14.9 kB)
Comment
Add comment · Show 1
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 Bunzaga · Nov 18, 2012 at 06:59 PM 0
Share

I am also having this issue, only I am using it in a raycast.

I cast a ray from the camera a point in the world, where the mouse position is, and base my character rotation and a GUI element on this hit position.

The problem is, it lags behind when the mouse is in motion, as though it is taking the previous mouse position, rather than the current.

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

10 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

Related Questions

How do I create a shape that rotates from one pivot point, to always point towards the mouse cursor? 2 Answers

Playmaker Mouse Over 0 Answers

Fire missile to mouse click 1 Answer

Mouse events for object with character controller 1 Answer

trying to move an object with the mouse 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