collider.avoidSelfInteractionMask not working well and O.reset() does not reset it.
Hello,
I am trying to setup properly the possible interaction between different group of sphere: some can interact with other, some cannot interact with themselves
here the basic code `# basic simulation showing sphere falling ball gravity,
bouncing against another sphere representing the support
DATA COMPONENTS
add 2 particles to the simulation
they the default material (utils.defaultMat)
mask1=0b10 mask2=0b01 mask3=0b11
O.bodies.append([ # fixed: particle's positionin space will not change (support) sphere(center=(0,0,0),radius=.5,fixed=True,mask=mask1,color=(0,0,1)), #fond immobile sphere(center=(0,0,2),radius=.5,fixed=False,mask=mask2,color=(0,1,0)), # these particles are free, subject to dynamics sphere(center=(0,0,4),radius=.5,fixed=False,mask=mask3,color=(1,0,0)), sphere(center=(0,0,6),radius=.5,fixed=False,mask=mask3,color=(1,0,0)), # fixed: particle's positionin space will not change (support) sphere(center=(3,0,0),radius=.5,fixed=True,mask=mask1,color=(0,0,1)), #fond immobile sphere(center=(3,0,2),radius=.5,fixed=False,mask=mask3,color=(1,0,0)), # these particles are free, subject to dynamics sphere(center=(3,0,4),radius=.5,fixed=False,mask=mask2,color=(0,1,0)), sphere(center=(3,0,6),radius=.5,fixed=False,mask=mask2,color=(0,1,0)), # fixed: particle's positionin space will not change (support) sphere(center=(6,0,0),radius=.5,fixed=True,mask=mask3,color=(1,0,0)), #fond immobile sphere(center=(6,0,2),radius=.5,fixed=False,mask=mask1,color=(0,0,1)), # these particles are free, subject to dynamics sphere(center=(6,0,4),radius=.5,fixed=False,mask=mask3,color=(1,0,0)), sphere(center=(6,0,6),radius=.5,fixed=False,mask=mask2,color=(0,1,0)), # fixed: particle's positionin space will not change (support) sphere(center=(9,0,0),radius=.5,fixed=True,mask=mask2,color=(0,1,0)), #fond immobile sphere(center=(9,0,2),radius=.5,fixed=False,mask=mask1,color=(0,0,1)), # these particles are free, subject to dynamics sphere(center=(9,0,4),radius=.5,fixed=False,mask=mask3,color=(1,0,0)), sphere(center=(9,0,6),radius=.5,fixed=False,mask=mask2,color=(0,1,0)), # fixed: particle's positionin space will not change (support) sphere(center=(12,0,0),radius=.5,fixed=True,mask=mask1,color=(0,0,1)), #fond immobile sphere(center=(12,0,2),radius=.5,fixed=False,mask=mask1,color=(0,0,1)), # these particles are free, subject to dynamics sphere(center=(12,0,4),radius=.5,fixed=False,mask=mask3,color=(1,0,0)), sphere(center=(12,0,6),radius=.5,fixed=False,mask=mask2,color=(0,1,0)),
])
FUNCTIONAL COMPONENTS
collider.avoidSelfInteractionMask = 0b00
simulation loop -- see presentation for the explanation
O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom()], # collision geometry [Ip2_FrictMat_FrictMat_FrictPhys()], # collision "physics" [Law2_ScGeom_FrictPhys_CundallStrack()] # contact law -- apply forces ), # Apply gravity force to particles. damping: numerical dissipation of energy. NewtonIntegrator(gravity=(0,0,-9.81),damping=0.1)
]
set timestep to a fraction of the critical timestep
the fraction is very small, so that the simulation is not too fast
and the motion can be observed
O.dt=.5e-4*PWaveTimeStep()
save the simulation, so that it can be reloaded later, for experimentation
O.saveTmp()`
so the three masks are : mask1=0b10 blue mask2=0b01 green mask3=0b11 red
and the result for collider.avoidSelfInteractionMask 0b00 full interaction 0b01 full no interaction 0b10 full interaction 0b11 full no interaction
according to the definiton of the mask "This mask is used to avoid the interactions inside a group of particles. To do so, the particles must have the exact same mask and that mask should have one bit in common with this avoidSelfInteractionMask as for their binary representations" this should not be ful or zero interactions???
I guess that something is wrong?