Page 1 of 1

can pybullet simulate air friction or other types of friction?

Posted: Fri Dec 29, 2017 2:40 am
by deepcode
I am trying to emulate a demo with objects falling out of the sky at different speeds:
http://brm.io/matter-js/demo/#airFriction
Reading through the documentation, It doesn't seem like pybullet has friction except for joint friction. is this possible to do in pybullet?
how can I change the parameters to the spheres so they fall at different speeds?

Code: Select all

import pybullet as p
import random
p.connect(p.GUI)
p.setGravity(0,0,-0.001)
p.setRealTimeSimulation(0)
objects = {}
def create_snow():
  for i in range(50):
    objects[i] = p.createCollisionShape(p.GEOM_SPHERE)
    p.changeVisualShape(objects[i],-1,rgbaColor=[random.random(),random.random(),0,1])
    p.createMultiBody(random.randint(1,10),objects[i],-1,basePosition=[random.randint(-10,10),random.randint(-10,10),random.randint(2,5)])
for i in range(1000000000):
  p.stepSimulation()
  if i % 100000 == 0:
    create_snow()
    

Re: can pybullet simulate air friction or other types of friction?

Posted: Wed Jan 03, 2018 4:04 pm
by Erwin Coumans
You can change the linear damping to emulate very simple air resistence.
Use pybullet.changeDynamics for this, see the pybullet quickstart guide.

More advanced force fields need to be written as custom code, either in python or as a pybullet C/C++ plugin.