Erel B4X founder Staff member Licensed User Longtime User Aug 28, 2018 #1 The WheelJoint is similar to a RevoluteJoint with a spring that allows the bodies to move along a defined axis. The movement is done by enabled the joint motors. If you run it with debug drawing enabled you will see two additional fixtures: The bottom one is a heavy fixture that helps with stabilizing the car. It is destroyed after 100 meters to make the car crash. The top one is very light and it used to find out when the car rolled over. Getting the physics to behave nicely was challenging and it still needs a bit fine tuning. There are many parameters that affect the behavior. The hills in this example are too steep. It would have been better to use different tile set with more gentle heels. The example will be added to the examples pack. https://www.b4x.com/android/forum/threads/xui2d-example-pack.96454/ Tileset credit: http://www.kenney.nl
The WheelJoint is similar to a RevoluteJoint with a spring that allows the bodies to move along a defined axis. The movement is done by enabled the joint motors. If you run it with debug drawing enabled you will see two additional fixtures: The bottom one is a heavy fixture that helps with stabilizing the car. It is destroyed after 100 meters to make the car crash. The top one is very light and it used to find out when the car rolled over. Getting the physics to behave nicely was challenging and it still needs a bit fine tuning. There are many parameters that affect the behavior. The hills in this example are too steep. It would have been better to use different tile set with more gentle heels. The example will be added to the examples pack. https://www.b4x.com/android/forum/threads/xui2d-example-pack.96454/ Tileset credit: http://www.kenney.nl
Erel B4X founder Staff member Licensed User Longtime User Aug 28, 2018 #2 Just made an update. In some cases it took sometime for the car to start moving. With debug drawing I found that it happened when the car is sleeping. So the solution is to uncheck the 'allow sleep' for the car and wheels:
Just made an update. In some cases it took sometime for the car to start moving. With debug drawing I found that it happened when the car is sleeping. So the solution is to uncheck the 'allow sleep' for the car and wheels:
NJDude Expert Licensed User Longtime User Aug 28, 2018 #3 Cool! I hate to be that guy but, it's actually Monster Truck, not trunk.
Johan Hormaza Well-Known Member Licensed User Longtime User Aug 28, 2018 #4 Extraordinary!!! rest a little EREL .... jejeje
Erel B4X founder Staff member Licensed User Longtime User Aug 28, 2018 #5 NJDude said: I hate to be that guy but, it's actually Monster Truck, not trunk. Click to expand... Thank you for being that guy!
NJDude said: I hate to be that guy but, it's actually Monster Truck, not trunk. Click to expand... Thank you for being that guy!
S sorex Expert Licensed User Longtime User Aug 28, 2018 #6 Great! What is wonder is if you need to set a maximum left/right rotation angle on the springs. The wheel would go over the car otherwise, not? Is there a specific reason why the car polygon doesn't go around the car (car+wheel caps) only? (not including the wheel centers)
Great! What is wonder is if you need to set a maximum left/right rotation angle on the springs. The wheel would go over the car otherwise, not? Is there a specific reason why the car polygon doesn't go around the car (car+wheel caps) only? (not including the wheel centers)
Cableguy Expert Licensed User Longtime User Aug 28, 2018 #7 NJDude said: Cool! I hate to be that guy but, it's actually Monster Truck, not trunk. Click to expand... It could be worse... truck... trunck.. . Drunk...
NJDude said: Cool! I hate to be that guy but, it's actually Monster Truck, not trunk. Click to expand... It could be worse... truck... trunck.. . Drunk...
Erel B4X founder Staff member Licensed User Longtime User Aug 28, 2018 #8 sorex said: What is wonder is if you need to set a maximum left/right rotation angle on the springs. The wheel would go over the car otherwise, not? Click to expand... The joint allows the wheel to turn around themselves. They will not be able to turn if there were limits (this is why there is no limit feature in WheelJoint). sorex said: Is there a specific reason why the car polygon doesn't go around the car (car+wheel caps) only? Click to expand... You should try it. If the car polygon is too low then it will hit the ground.
sorex said: What is wonder is if you need to set a maximum left/right rotation angle on the springs. The wheel would go over the car otherwise, not? Click to expand... The joint allows the wheel to turn around themselves. They will not be able to turn if there were limits (this is why there is no limit feature in WheelJoint). sorex said: Is there a specific reason why the car polygon doesn't go around the car (car+wheel caps) only? Click to expand... You should try it. If the car polygon is too low then it will hit the ground.
S sorex Expert Licensed User Longtime User Aug 28, 2018 #9 I will play around with it. Thanks for the new 0.98 Xui2D update (which is required for this).
S sorex Expert Licensed User Longtime User Aug 29, 2018 #10 I ran it last night and it's very smooth & realistic, well done. Last edited: Aug 29, 2018
LucaMs Expert Licensed User Longtime User Aug 29, 2018 #11 For the moment I have not used XUI2D, so my question is certainly not very inherent the topic: the poor quality (resolution) of the vehicle to what is due?
For the moment I have not used XUI2D, so my question is certainly not very inherent the topic: the poor quality (resolution) of the vehicle to what is due?
Erel B4X founder Staff member Licensed User Longtime User Aug 29, 2018 #12 It is a small sprite. The video is taken from an iPhone. It looks better on the device.
LucaMs Expert Licensed User Longtime User Aug 29, 2018 #13 I would choose a bigger image to post a better video
wyatt420 Member Licensed User Longtime User Sep 30, 2018 #14 how can you check the truck is on the ground? do you need to add sensors to the wheels and check wheel/ground collision?
how can you check the truck is on the ground? do you need to add sensors to the wheels and check wheel/ground collision?
Erel B4X founder Staff member Licensed User Longtime User Sep 30, 2018 #15 You don't need to add sensors. Add this code to the Tick sub: Code: Copy If FrontJoint.BodyB.GetContactList(True).Size > 0 Or RearJoint.BodyB.GetContactList(True).Size > 0 Then Log("on ground") Else Log("in air") End If It tests whether one of the wheels touches something.
You don't need to add sensors. Add this code to the Tick sub: Code: Copy If FrontJoint.BodyB.GetContactList(True).Size > 0 Or RearJoint.BodyB.GetContactList(True).Size > 0 Then Log("on ground") Else Log("in air") End If It tests whether one of the wheels touches something.