Jump to content

Joint:Ball()'s serious physic problem


Recommended Posts

function Script:Start()
	local box = Model:Box(0.5,0.5,0.5)
	box:SetPosition(0,4,0)
	box:SetMass(1)
	box:SetCollisionType(Collision.Prop)

	local pos = box:GetPosition(true)
	local joint = Joint:Ball(pos.x, pos.y - 1, pos.z + 1,box)
	--This makes sure that box has high velocity after dropping

	joint:SetFriction(200)
end

And I got this, I think there is a problem with Joint:Ball (and Joint:Hinge - I tried too) of velocity and gravity interaction

 

Link to comment
Share on other sites

I'm no expert but aren't you moving the joint to give your box its momentum.

If you look at the example in the documentation you set the joints position then apply Torque to the object to get it to rotate.

If you remove the Y component in your script the box swings.

If you add to the X component with no Y or Z the box swings.

Is this the behavior you are looking for?

Link to comment
Share on other sites

On 1/12/2018 at 2:19 PM, AggrorJorn said:

Maybe the mass is too low? For the ropes I use a mass of 10.

SetMass(10) even (100) is no use, my box still spin around the joint like crazy

this video I made a simple joint:ball with a light which has the same code and it worked properly (LE4.1 with old Newton) You can see the diffirence.

 

On 1/12/2018 at 2:55 PM, Thirsty Panther said:

I'm no expert but aren't you moving the joint to give your box its momentum.

If you look at the example in the documentation you set the joints position then apply Torque to the object to get it to rotate.

If you remove the Y component in your script the box swings.

If you add to the X component with no Y or Z the box swings.

Is this the behavior you are looking for?

I did not move the joint, i let it stay still, and I dont want to addTorque, just leave it there, then I can simulate a hanging target to shoot. I wonder why Josh does not pay any attention

Link to comment
Share on other sites

27 minutes ago, Thirsty Panther said:

local joint = Joint:Ball(pos.x, pos.y , pos.z + 1,box)

When I use the above code I get the result you are after. Or if you use 


local joint = Joint:Ball(pos.x+1, pos.y - 1, pos.z,box)

If you +1 or -1 the Y variable it goes crazy.

Yes it is, the reason I use "pos.y - 1" is that will make the box become higher than Joint position so when the box falls down, it will have enough velocity to traverl at least 1 round. the bad thing is its velocity was NOT decreased by gravity, and it become bigger and biger, thus it spin like hell.

if you only use pos.z + 1, you can see the box will move forever, and if you use box:AddForce(--with a big force vector--) that box will go crazy again.

It feels like mass and friction is nothing in leadwerks

Link to comment
Share on other sites

  • Josh locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...