I have attached a boxcollider to the gameObject and whenever I swipe up(vertically) the gameObject,the object moves to a certain height but the collider tends to be on the ground itself. What is the possible reason for it and how can I solve this.
If you are using animation add the collider to the child of the mesh e.g Hips
I know its an old thread, but I had a similar issue with BoxCollider2D and the thing was that my collider was a child with a RigidBody2d, I just removed the RigidBody and problem solved.
Ok so I assume that you didn’t describe everything we needed to know. But don’t worry I’ll try to help you. Just follow the steps on moving the Gameobject with a box collider upwards.
Step 1: Click ‘Add Component’ then → ‘Physics’ then → ‘Box Collider’
Step 2: Drag the object around and the Box Collider moves with it because it is a Component
Step 3: Works with multiple objects too
If this doesn’t work well then you have a problem and need to read completely this page Unity - Manual: Box Collider component reference . Please if you liked my answer, check out our alpha game that’s coming out this Wednesday at http://humanityfalling.weebly.com/ . Please join us if you want.
@zzeeshann Thanks! This worked. I was adding the collider to the mesh of my players’s left hand but the collider wasn’t moving with the player’s hand. Once I attached it to the skeleton (Hips > Spine…>Hand L) it stuck to the hand.