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 RaulG · Jul 21, 2013 at 06:30 AM · collisionparenting

Collision between Character Controller and another object sends other object flying

This is a weird one. For some odd reason every time my Player Obj collides with the sides or at times the bottom of another object, the other object is sent flying or gets sucked into the player object.

What would be the causes of this? And is there anyway to fix this?

This is the collision script. The parenting on Player to Platform also does not seem to work properly.

 using UnityEngine;
 using System.Collections;
 
 public class AllCollisionScript : MonoBehaviour 
 {    
     public AllSpawnScript ss;
     
     void OnCollisionEnter(Collision other)
     {
     
         if (other.collider.tag == "Platform")
         {
             ss.tList.Remove(ss.PlatformOBJChild);
             GameObject.Destroy(gameObject);
             Debug.Log("Resetting Platform!");
         }
         if (other.collider.tag == "PlatformEnd")
         {
             ss.tList.Remove(ss.PlatformOBJChild);
             GameObject.Destroy(gameObject);
             //Debug.Log("Platform reached END");
         }
         if (other.collider.tag == "Player")
         {
             Debug.Log ("Is Parented");
             ss.PlatformOBJChild.parent = ss.PlayerOBJChild;
         }
         else
         {
             return;
         }
 
     }
 
 }
 
Comment
Add comment · Show 9
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 Benproductions1 · Jul 21, 2013 at 11:29 PM 0
Share

OnCollisionEnter is not called for character controllers. You must have something else you are not showing

avatar image RaulG · Jul 28, 2013 at 02:18 AM 0
Share

I don't have much for the collision script. I just finished adding in raycast collision but since the platforms are long the raycast doesn't seem to hit.

EDIT: OH WAIT! Dude, I have NOTHING else. That's the problem.

How do I get collision from a character controller?

avatar image robertbu · Jul 28, 2013 at 02:49 AM 0
Share

Is there a collider on your character controller and a rigidbody on either the controller or the object being hit?

avatar image RaulG · Jul 28, 2013 at 02:59 AM 0
Share

Player has a RigidBody, object being his has a collider and a rigidbody.

I used OnControllerColliderHit and that gave me somewhat the results I wanted.

So... I then checked my rigidbodies and froze all the XYZ, now that gave me more of what I wanted BUT the character falls through.

I froze them on both the Player and Object hit.

avatar image robertbu · Jul 28, 2013 at 03:06 AM 0
Share

Typically you don't have a collider or a rigidbody on the same game object that has a character controller. $$anonymous$$ake sure your character starts a bit above the floor, and that the floor has a collider.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by imaginationrabbit · Jan 09, 2017 at 11:37 AM

I made a script that is rough but solves this issue- you can find it here link text

Comment
Add comment · 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

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

16 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to parent gameobject at point of collision? 0 Answers

[VIDEO]how to collision.transform.parent = transform.position ?(Parenting) 1 Answer

Parenting ethans hand to a gameobject 0 Answers

Parenting after X time with collision, I dont get it! 1 Answer

Help with collision detection with specific colliders 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