tipforeveryone Posted June 23, 2017 Share Posted June 23, 2017 I tested Join:Ball() today and found out a problem with the parent entity Here is my modified code from https://www.leadwerks.com/docs?page=API-Reference_Object_Joint_Ball parent = Model:Box() parent:SetColor(0.0,0.0,1.0) parent:SetMass(0) parent:SetPosition(1,0,0) --Move parent box a little bit to the right parent:SetGravityMode(false) child = Model:Box() child:SetColor(1.0,0.0,0.0) child:SetMass(1) child:SetPosition(2,0,0) child:AddTorque(10,0,0) As I expected, the child object's joint position shoud follow the parent object position. but not. child object's joint position is still at Global position (0,0,0) Link to comment Share on other sites More sharing options...
tipforeveryone Posted June 24, 2017 Author Share Posted June 24, 2017 anyone has any idea ? or I dont get the right point ? Link to comment Share on other sites More sharing options...
Admin Posted March 12, 2019 Share Posted March 12, 2019 Do this: --Create a window window = Window:Create() context = Context:Create(window) world = World:Create() camera = Camera:Create() camera:Move(0,0,-4) local light = DirectionalLight:Create() light:SetRotation(35,35,0) local parent = nil local child = nil parent = Model:Box() parent:SetColor(0.0,0.0,1.0) parent:SetMass(0) parent:SetPosition(1,0,0) --Move parent box a little bit to the right parent:SetGravityMode(false) child = Model:Box() child:SetColor(1.0,0.0,0.0) child:SetMass(1) child:SetPosition(2,0,0) child:AddTorque(10,0,0) local pos = parent:GetPosition(true) local joint = Joint:Ball(pos.x, pos.y, pos.z, child, parent) while true do if window:Closed() or window:KeyHit(Key.Escape) then return false end Time:Update() world:Update() world:Render() context:Sync() end Link to comment Share on other sites More sharing options...
Recommended Posts