(gif below)
I have this little dude that I built
- body and legs are of type
BulletRigidBodyNode('Box')
.
- legs are connected to the body with
BulletGenericConstraint
- I make him jump on each separate leg by with
np.node().applyCentralForce(force)
.
as seen in the gif below, each time i make him jump on a certain leg, the force is printed right beneath the game window
Problem 1: by the end of the gif he comes to complete rest, and for some reason applying force doesnt work anymore (took me a while to get him to rest)
Problem 2 feels like the sim runs very slow. the blue box weights 1kg and each leg 0.7kg. I also used:
world = BulletWorld()
world.setGravity(Vec3(0, 0, -9.81))
but he was falling real slow. in the gif i set the gravity to -19.81
to make it look more lifelike
1 Like
I suspect that the physics objects might be “going to sleep”–deactivating as a result of not moving for a certain amount of time.
What happens if, before you apply your force, you call “setActive(True)
” (or, if that doesn’t work, “setActive(True, True)
” on the physics object to which you intend to apply the force?
(See the API here.)
This is a bit of a stab in the dark, but what time-step are you applying in your call to your BulletWorld’s “doPhysics” function?
[edit]
Oh, and if you activate the frame-rate meter, what frame-rate does it report?
Wow thanks! setActive
solved the body freeze issue
as for the slow speed, here’s my update function
def update(self, task):
self.apply_changes()
dt = globalClock.getDt()
self.world.doPhysics(dt)
return task.cont
dt values :
0.01573189999999869
0.017784699999999987
0.015488900000001138
0.01661449999999931
0.016562500000000924
0.016226499999998367
and the frame-rate shows 60 fps
1 Like
I’m glad that the former helped!
As to the slowness, hmm… What you posted looks right, to me.
Hmm… It’s another bit of a stab in the dark, but do you see any change to the effect of gravity if you remove the constraint…?
(Perhaps then hack in an extra force on the main box, in order to see how that moves when not affected by the “legs”.)
removed constraints, no change in speed
also tried to run only the blue box (without legs), same result
Hmm–then I’m afraid that I don’t know! :/
But perhaps someone else on the forum might!
I appreciate your help! thank you
1 Like
I had this issue with slow physics and tried the same solution (increasing gravity) but then this led to motion that was not smooth…
The solution for me turned out to be that panda3D was running on my Intel integrated graphics. After setting the install of python utilized by panda3D to run on the GPU (using Windows graphics settings) the problem was fixed and the physics was blazing fast. Gravity behaved as expected.
Not sure why this happened. Confusingly the panda3D framerate wasn’t bad on the iGPU but the physics was just very slow.
1 Like