- Home /
Cube collision problems when held
I already coded so that my player can grab/drop small crates, i'm using character controller on my player but problem is when the player is carrying a crate, it does not collide against other objects at all, whether i make crate.position = hands.position or make the crate a child of player.
any ideas/tips at all what i can do to fix that? thx you.
im guessing i'll have the same problem when coding a push/pull script for other types of crate
Does crate have rigidbody, mesh or primitive collider?
get a lerped value between the current position and a desired position, then use rigidbody.$$anonymous$$ovePosition ins$$anonymous$$d of setting the transform :
calcPos = Vector3.Lerp( currentPos, desiredPos, grabLerpFactor );
rigidObject.$$anonymous$$ovePosition( calcPos );
An alternative is to save the position you grab it at in a vector and constantly add force in that direction multiplied by the distance (temporary high drag as well) so it doesn't orbit.
Your answer
Follow this Question
Related Questions
Amnesia like objects, in unity. 2 Answers
How to set Player to push only during pushing animation 1 Answer
adding Up force 0 Answers