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 JBDenton · Jul 03, 2012 at 08:43 PM · collisionphysicsraycastingnormal

Collision normals changing based on player position

Hi, I'm working on a project with the Novint Falcon right now. I'm using a C# wrapper I found on these forums, but that's not the problem. Right now I have a fist that I'm using to smack into a cube and apply force back. I can detect the collision successfully, but when I apply the force back to the Falcon, it'll only put it in the right direction if I'm facing in the same orientation as the cube I'm hitting. The first picture shows the orientation where the correct force is applied, the second is where the incorrect force is applied. They're kinda hard to see but the top has the cube to the right, the second the cube is to the left.

correct collision-force is applied away from the cube

incorrect collision-force is applied towards the cube

When I print the normal of the contact points of each collision, they are the same. Could it be my coordinates that are messing everything up?

Here's some code:

     internal void SetServoPos(Vector3 pos, double strength)
  {
  double[] _pos = new double[3];
  _pos[0] = pos.x;
  _pos[1] = pos.y;
  _pos[2] = pos.z;
 
  SetServoPos(_pos, strength);
  }
  
  void OnCollisionEnter(Collision other2)
  {
     
         print("First normal of the point that collide: " + other2.contacts[0].normal);
  
  foreach(ContactPoint contact in other2.contacts){
  Debug.DrawRay (contact.point,contact.normal,Color.green,5,false);
  
  }
 
  
  SetServoPos(other2.contacts[0].normal,2);
  
  
  
  }
  
  
  void OnCollisionExit(Collision other1)
  {
  
  SetServoPos(new double[3]{0,0,0},0.5);
  }
  
  
  
  void Update ()
  {
        
  
  gameObject.transform.localPosition = new Vector3( (float)GetXPos(), (float)GetYPos(), (float)GetZPos()*-1 + 3);
  
  
  //Debug.Log ( isButton0Down() + " , " + isButton1Down() + " , " + isButton2Down() + " , " + isButton3Down() );
  
  }



Any help would be appreciated. Thanks!

correct.png (275.1 kB)
incorrect.png (321.3 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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Problem with custom raycast2D collision detection system. 1 Answer

Getting surface normal from collision 1 Answer

Direction/Hit Detection without triggers. 1 Answer

Using Raycasts to change the X and Y position of a moving GameObject? 1 Answer

Rigidbodies won't collide if mass difference is too high 0 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