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
1
Question by opdude · Jan 30, 2013 at 01:40 PM · collisionrigidbodybugfpspickup

Duplicated object doesn't collide but original does

Hi there,

I have an FPS game where you are able to pickup objects (floats in front of the camera until dropped) and carry them around, I also have doors in which the player can't walk through however it seems when a player has picked up an object the object can go through those doors, but however ONLY if that door has been cloned! If I for example build the component again from scratch in the editor the collision works just fine.

Now I'm wondering which of the two are correct, is there a bug in my initial object and the picked up object should go through the door or should the object never go through the door. Below I've explained how things are setup in my scene, thanks for any help you can give.

Edit: Even weirder I have now tried to Instantiate the object while in game instead of dragging in the prefab and that seems to work with the collision.

Edit 2: Okay so only the last instance created seems to work if I place new ones into the scene while it's running the last one created then stops collisions while all the others (even if they previously worked) now stop. There really does seem to be a unity bug behind this.

Player

Rigidbody (on Child Object)

  • Mass: 0.2
    • Gravity: off

    • Freeze Postions: all on

    • Free Rotations: all on

      Pickupable Object

      Rigidbody

  • Mass: 0.3
    • Gravity: on

      Door

      Rigidbody

  • Mass: 1
    • Gravity: on

      Configurable Joint

  • Axis: 0 1 0

    • XMotion: Locked

    • YMotion: Locked

    • ZMotion: Locked

    • Angular XMotion: Limited

    • Angular YMotion: Locked

    • Angular ZMotion: Locked

    • Low Angular XLimit: 0

    • High Angular XLimit: 110

      How it happens

    1. Player moves over to pickupable object and hits a button to pick it up

    2. The object is then attached to the rigidbody on the child object of the player via a Spring joint

    3. The player can now move around with the pickedup object in front of the camera

    4. Player now walks up to the door, if the door has been created from scratch the picked up object refuses to go through the door and just gets closer to the player. Otherwise if the door has been duplicated or pulled in as a prefab the player can walk through the door.

Comment
Add comment · Show 2
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 Qvintusdk · Jan 31, 2013 at 08:59 AM 0
Share

Have you made sure to add a collider to the prefab?

avatar image opdude · Jan 31, 2013 at 09:04 AM 0
Share

Yeah there are definitely colliders to both the picked up object and to the doors, they even send OnCollisionEnter calls they just allow the picked up obejct right through them! However the problem doesn't seem to lie in the prefab itself as the first object I create always works then if I duplicate them or drag it in as a prefab it will then not work.

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by opdude · Jan 31, 2013 at 09:09 AM

Okay so I don't really have an answer for this but rather a work around that I have found, which is to recreate the doors while the game is running. This seems to solve the issue for now although I won't be holding my breathe that's for sure! There does seem to be some underlying but in unity that is causing this issue.

I have attached a script that will recreate the object for anyone else who comes up with a similar issue as I did.

 using UnityEngine;
 
 public class RecreateSelf : Monobehavious
 {
     public bool Recreated = false;
     void Awake ()
     {
         if (!Recreated)
         {
             Recreated = true;
             var newObject = Instantiate(gameObject, gameObject.transform.position, gameObject.transform.rotation) as GameObject;
             if (newObject != null)
             {
                 newObject.name = gameObject.name;
                 newObject.transform.parent = gameObject.transform.parent;
             }
             else
             {
                 Debug.LogError("Unable to re-create instance?");
             }
             Destroy(gameObject);
         }
         else
         {
             Destroy(this);
         }
     }
 }
 
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

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 you add a fixed joint to a first person controller 1 Answer

Delayed Collisions Bug continued... 0 Answers

RigidbodyFPSWalker physics problem 0 Answers

Collision Problem with Rigidbody? 1 Answer

Enemy death help 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