Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 question was closed Dec 13, 2015 at 10:52 PM by blitzcloud for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by blitzcloud · Dec 14, 2015 at 10:11 AM · collisioncolliderrigibody

Problems with collision under certain circumstances.

 function OnCollisionEnter(collision: Collision) {
 var chrpos=chr.GetComponent.<Rigidbody>();
 var posx:float=chrpos.position.x;
 var posz:float=chrpos.position.z;
 
     if (collision.gameObject.name == "_CHARACTER"){
         if (chrpos.position.y<14){
         Debug.Log(chrpos.position.y);
         Debug.Log("you got rekt");
         chr.GetComponent(character).kill();
         gameover.GetComponent(game_over).GameOver();
         }
         else
         {
             if (chrpos.position.y<16){chrpos.position=Vector3(posx,16,posz);}
         chr.GetComponent(character).grounded();
         }
     }
 }


Don't pay too much attention to the quality of the script as of now because i'm just brainstorming some basic logic. And it works. It works perfectly as long as I have either jumped recently or jumping at the moment. If the character is position.y=14 or above it gets moved up so it gets a bit less frustrating for the player, and all of that works.

However if I leave the player on the ground, he simply warps through the collider, despite being 2 colliders with one rigidbody.

Changing the collision method (Discrete etc) doesn't help at all either. In fact, it works perfectly with all of them except under the circumstances I mentioned.

The collision gets ignored, but if I jump again while inside the collider, it gets the job done aswell. Of course that shouldn't happen as it should have detected it beforehand.

I'm kinda lost as to what to do, to be honest.

I should mention that the character is not moving and the actual moving object is the one without the rigidbody. Could that be the issue? Although it doesnt explain why it's working in the other circumstances then

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 blitzcloud · Dec 13, 2015 at 10:52 PM 0
Share

Of course the problem was the obstacle not having a rigidbody.

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Player starts moving in one direction nonstop after colliding with any other object 1 Answer

Colliding two GameObjects 1 Answer

How to do collision of external objects on script? 1 Answer

Detect and react to collisions 2 Answers

Check Object Is Not Colliding 2 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