There are xui2d.jar and x2.b4xlib files in library folder of B4J (or B4A) x2.b4xlib is X2 framework and it uses xui2d.jar I think ? (although can not see any reference in X2 source files)
I see a method called setTangentSpeed for b2contact class in a jbox2d page.. It is used for conveyor or tank palet movements. But X2 has no such method for Contact.. How can I use this method ? I can see it when I open xui2d.jar and look into class files with Notepad++.
@ShortName("B2Contact")
public class B2Contact {
@Hide
public Contact contact;
This means that you can access the native contact with:
B4X:
Dim TangnetSpeed As Float = 12
'contact is the B2Contact object
contact.As(JavaObject).GetFieldJO("contact").RunMethod("setTangentSpeed", Array(TangnetCode)
Thank you so much @Erel. I tried and it works.. May be someone else wants to try this method, I add 2 subs to Tank Attack sample program.. And tank starts to move without pressing any keys, ground behaves like a conveyor.. Tank's brake system is broken possibly PreSolve and BeginContact occurs when there is a collision, then you can manipulate the results of collision in PreSolve. Tank palet and ground are in collision. PreSolve sub is not trigerred without BeginContact sub..
B4X:
Sub World_PreSolve (Contact As B2Contact, OldManifold As B2Manifold)
Dim bc As X2BodiesFromContact = X2.GetBodiesFromContact(Contact, "tank")
Dim TangentSpeed As Float = 5
If bc <> Null And bc.OtherBody.Name.StartsWith("ground") Then
'Contact.IsEnabled = False
Contact.As(JavaObject).GetFieldJO("contact").RunMethod("setTangentSpeed",Array(TangentSpeed))
End If
End Sub
Sub World_BeginContact (Contact As B2Contact)
End Sub