Yes, here it is.Can you upload the project?
Hello,
Do we have any possibility to set the force how strong the joints (B2RevoluteJointDef) are?
If we create a chain it looks more or less like a rubber band.
Greetings
X2.GraphicCache.PutGraphic2("ball", Array(sb), True, 3)
yAnchor = PendulumPivot.Body.WorldCenter.Y
Sub Class_Globals
Public bw As X2BodyWrapper
Private x2 As X2Utils 'ignore
Dim impulsValue As Float = 5
Private ApplyForce As Boolean
End Sub
Public Sub Initialize (wrapper As X2BodyWrapper)
bw = wrapper
x2 = bw.X2
End Sub
Public Sub Tick (GS As X2GameStep)
If x2.mGame.Jump = True And ApplyForce = False Then
x2.mGame.Jump = False
ApplyForce = True
x2.AddFutureTask(Me, "Stop_Force", 100, Null)
x2.SoundPool.PlaySound("wing")
End If
If ApplyForce Then
bw.Body.ApplyForce(x2.CreateVec2(0, impulsValue), bw.Body.Position)
End If
If GS.ShouldDraw Then
bw.UpdateGraphic(GS, True)
End If
End Sub
Sub Stop_Force (ft As X2FutureTask)
ApplyForce = False
End Sub
Hello,
Do we have any possibility to set the force how strong the joints (B2RevoluteJointDef) are?
If we create a chain it looks more or less like a rubber band.
Greetings
Yea u have. What joint are u using?
Are you testing it with the force applied over a period?Because by adjusting the forces a little higher (5 Newton) the chain breaks soon.
Nope, just changed to your version.Are you testing it with the force applied over a period?
Dim template As X2TileObjectTemplate = TileMap.GetObjectTemplateByName(ObjectLayer, "chain")
Dim revdef As B2WheelJointDef
' Dim revdef As B2RevoluteJointDef
For i = 0 To intChainParts
'
y = yAnchor - (i * PartHeight) * 0.8
'
template.BodyDef.Position = X2.CreateVec2(x, y)
Dim BodyB As X2BodyWrapper = TileMap.CreateObject(template)
If (i Mod 2 = 0) Then
BodyB.CurrentFrame = 0
Else
BodyB.CurrentFrame = 1
End If
'
If i=0 Then
' revdef.Initialize(PendulumPivot.Body, BodyB.Body, X2.CreateVec2(x, y))
revdef.Initialize(PendulumPivot.Body, BodyB.Body, X2.CreateVec2(0, 0), X2.CreateVec2(0, 1.))
Else
' revdef.Initialize(BodyA.Body, BodyB.Body, X2.CreateVec2(x, y))
revdef.Initialize(BodyA.Body, BodyB.Body, X2.CreateVec2(0, PartHeight*0.9), X2.CreateVec2(0, 1.))
End If
'
revdef.DampingRatio = 0.9
revdef.FrequencyHz = 10
'
world.CreateJoint(revdef)
'
BodyA.Body = BodyB.Body
Next
This is the case with the code I posted in post in post #7. I wasn't able to break the chain with this code.Nope, just changed to your version.
Correct, but the chain is bumping like an elastic band also in that code. I assume by its own weight.
Here the Project with WheelJoints which are not doing the job better in this implementation.
'
revdef.Initialize(BodyA.Body, BodyB.Body, BodyA.Body.Position, BodyB.Body.Position)
'
revdef.DampingRatio = 1
revdef.FrequencyHz = 30
'
With DistanceJoint the same as with wheelJoints.
B4X:' revdef.Initialize(BodyA.Body, BodyB.Body, BodyA.Body.Position, BodyB.Body.Position) ' revdef.DampingRatio = 1 revdef.FrequencyHz = 30 '
Any higher FrequencyHz will inject a Resonance to the links.
You mean, may be a wrapper issue of b2box here concerning the joints?