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
- Player moves over to pickupable object and hits a button to pick it up
- The object is then attached to the rigidbody on the child object of the player via a Spring joint
- The player can now move around with the pickedup object in front of the camera
- 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.