View Single Post
  #2  
Old 01-23-2017, 11:45 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Reducing the bounce of the box may help prevent it from falling over after it's dropped. Here's an example:

Code:
'''
Press spacebar to enable physics and drop the box
'''

import viz
import vizact
import vizshape
import vizinfo

viz.go()
vizinfo.InfoPanel()

viz.clearcolor(viz.SLATE)
ground = viz.add('ground.osgb')
ground.collidePlane()

box = vizshape.addBox(size=(.4,2,0.4),pos=[0,20,8])
shape = box.collideBox()
shape.setBounce(0.01)

vizact.onkeydown(' ',viz.phys.enable)
If you want objects to snap into place after colliding try handling the collision event and then animate or directly place the object where you want it to go.
Reply With Quote