Hello, I am trying to manually set the dimensions of an object's collidebox. As a simple test, I tried setting the dimensions of the collidebox to the size of the object's bounding box. This works for box.wrl, but with the file tree.3ds (located at
https://www.stanford.edu/~tony516/tree.3DS), I get strange results. The tree on the left (which uses the default arguments for collidebox, behaves normally, but the tree on the right shoots up into the air.
Quote:
import viz, vizact
def setOnGround(obj):
ymin = obj.getBoundingBox().ymin
pos = obj.getPosition()
obj.setPosition(pos[0], pos[1]-ymin, pos[2])
def enablePhysics():
viz.phys.enable()
ground.collidePlane()
tree1.collidebox()
tree2.collidebox(tree2.getBoundingBox())
viz.go()
viz.clearcolor(viz.SKYBLUE)
viz.MainView.move(0,0,-15)
ground = viz.add('tut_ground.wrl')
tree1 = viz.add('tree.3ds')
tree2 = viz.add('tree.3ds')
tree1.scale([.2]*3)
tree2.scale([.2]*3)
tree1.setPosition(-10, 0, 15)
tree2.setPosition(10, 0, 15)
setOnGround(tree1)
setOnGround(tree2)
vizact.onkeydown('1', enablePhysics)
|
Thanks in advance for any help!