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 Pilchardo · Aug 23, 2014 at 10:24 PM · androidcollisionraycastcollidervectrosity

Problem with Vectrosity line colliders

I've drawn some Vectrosity lines and have added colliders to them:

 VectorLine line = new VectorLine("mirror" + mirrors.Count + 1, new Vector3[] { mirrorStart, mirrorEnd }, parameters.Material, parameters.Width);
 line.collider = true;

I then attempt to detect collisions with them using Physics2D.Raycast.

 RaycastHit2D hit = Physics2D.Raycast (startPoint, direction, Mathf.Infinity, layerMask);
 Collider2D collider = hit.collider;

I then use the collider to work out which (if any) object or line was hit. This works fine when running in the editor and also on the Nexus 4. However, when running on the Nexus 7, the raycast does not seem to hit any of the Vectrosity lines, passing straight through them instead. Everything else renders as I'd expect on the Nexus 7, despite the different screen resolution. This lack of collisions is the only discrepency I'm seeing when running on this device but I can't figure out what's causing it. Any ideas?

EDIT: As a test, I condensed the problem down into a single script and the same thing is happening. The script first creates a vertical line with a collider. Then, on each frame, a horizonal raycast is performed and a second line is drawn from an arbitrary start point to the collision point. In the editor and on the Nexus 4, the second line meets the first at a right-angle and stops. On the Nexus 7, however, the second line passes straight through. Here is the complete script:

 using UnityEngine;
 using System.Collections;
 using Vectrosity;
 
 public class TestScript : MonoBehaviour {
 
     VectorLine line = null;
     VectorLine secondLine = null;
 
     // Use this for initialization
     void Start () {
         Vector3 start = new Vector3 (0, 1);
         Vector3 end = new Vector3 (0, 3);
         line = new VectorLine("Bob", new Vector3[] { start, end }, null, 5);
         line.collider = true;
         line.Draw ();
     }
     
     // Update is called once per frame
     void Update () {
         Vector3 secondStart = new Vector3 (-1, 2);
         RaycastHit2D hit = Physics2D.Raycast (secondStart, Vector3.right);
         if (secondLine == null) {
             secondLine = new VectorLine ("Fred", new Vector3[] { secondStart, hit.point }, null, 5);
         } else {
             secondLine.points3[0] = secondStart;
             secondLine.points3[1] = hit.point;
         }
         secondLine.Draw ();
     }
 }

This is what I see in the editor and on the Nexus 4:

Editor behaviour

And here's what I see on the Nexus 7:

Nexus 7 behaviour

What could be causing this?

nexus7.png (44.1 kB)
editor.png (39.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

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

2 People are following this question.

avatar image avatar image

Related Questions

Surface with hole and Raycast - Which collider 1 Answer

Unity collision detection only for raycasts 1 Answer

Collider suddenly stops detecting collision? (bug?) 1 Answer

Detect RaycastHit on Character Controller 2 Answers

Prevent shooting when gun is inside wall 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