- Home /
Pick Up Object using Rigidbody FPS
I'm using this script to pick up objets with a rigidbody attached
if(isGrabbed)
{
GetComponent<Rigidbody>().velocity = Vector3.zero;
GetComponent<Rigidbody>().angularVelocity = Vector3.zero;
transform.SetParent(grabber.transform);
GetComponent<Rigidbody>().useGravity = false;
GetComponent<Rigidbody>().detectCollisions = true;
isGrabbed = true;
it's working perfectly if the FPS controller is using the default FPS Controller (the one without rigidbody) but when i attach a rigidbody (or use the rigidbody FPS prefab) the behaviour of the picked up object becomes weird: - it's correctly grabbed and moved in the position of my gun - it moves correctly with mouse - it moves correctly with player right, left and backward - if the player moves forward it DOESN'T move and stay suspended in the air, that's not what i want. it should move forward following the player transform and if NOT grabbed fall down on the floor. that's very weird.
can someone help pls?
Your answer
Follow this Question
Related Questions
Physics: Grab Object and Swing Freely Relative to Mouse Cursor 0 Answers
problem with rigidbody.position 1 Answer
Object not moving,Object not moving in any direction 1 Answer
Grabbed object won't stay still 0 Answers
Distance From & CrossHair 0 Answers