Jump to content

Inherited Parent Object Shape (Help)


Haydenmango
 Share

Recommended Posts

My problem is that the weapons collision shape doesn't change back to normal when it drops. I imagine that it keeps the shape it inherited from its parent.

 

Just wanted to say that this issue was fixed at some point.

I can now drop my weapon entities without using Instance() and their collision shapes stay the way they should. Final code (somebody may find this useful although you will need to change some things) --

elseif pickInfo.entity.script.weapon then
 if self.weapon~="torch" then
 if self.weaponentity~=nil then
 self.weaponentity.script:Drop(pickInfo.entity:GetPosition(true),pickInfo.entity:GetRotation(true))
 end
 self.weaponentity=pickInfo.entity
 self.weapon=self.weaponentity.script.name
 self.weaponentity:SetPickMode(0)
 self.weaponentity:SetMass(0)
 self.weaponentity:SetPosition(self.palm:GetPosition(true))
 self.weaponentity:SetRotation(self.palm:GetRotation(true)+self.weaponentity.script.rotation)
 self.weaponentity:SetParent(self.palm)
 self.weaponentity:SetCollisionType(Collision.None)
 self.weaponentity:SetShadowMode(0)
 return
 end
 end

Script.weapon=true
Script.weaponname=""  --string "Name"
Script.mass=1 --float "Mass"
Script.rotation=Vec3(0) --vec3 "Rotation"
--fighting values
Script.throwingweapon=true
Script.damage=5 --float "damage"
Script.range=2.5  --float "range"

function Script:Drop(position,rotation)
self.entity:SetParent(nil)
self.entity:SetMass(self.mass)
self.entity:SetCollisionType(Collision.Prop)
self.entity:SetShadowMode(1)
self.entity:SetPickMode(1)
self.entity:SetPosition(position)
self.entity:SetRotation(rotation)
end

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...