Jump to content

Pick up problem


Core
 Share

Recommended Posts

I have simple problem. I want to be able to remove cover/lid/door off some objects before I have access to them. Now I have it working with this simple script:

Script.cover = nil

function Script:Start()    
    self.cover = self.entity:FindChild("DoorElectronics1_11_cover")
    self.cover:SetMass(0)
end

function Script:Use(player)
    self.cover:SetMass(1)
end

So when I "use" parent entity, it makes the cover (child) to fall off. This is ok, but I want to be able to pick it up or even pick it up from it's place without dropping it to the floor. I have an idea how I will store covers original position to be able to put it even back to it's original place, but I can't seem to figure out how I can make the object from static to act like normal simple pickupable object with physics. Like the basic one when you have no script, set it's collision type to prob and give it a mass.

 

Here is video demonstration:

 

 

Edit. Ah, ok. It does not work if object I'm trying to pick up is parented to a static object. So self.cover:SetParent(nil) did the trick.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...