PDA

View Full Version : Show Physics Shapes


bloswald
04-06-2010, 07:40 AM
I have many different objects in my augmented reality environment with different collide shapes. Is there a way to make the physics shapes visible or transparent? It would make debugging a lot easier if I could see the shapes somehow.

Thanks!
-
bloswald :)

Jeff
04-06-2010, 11:35 AM
Take a look at the collideBox and collideSphere examples in the following page:

http://www.worldviz.com/vizhelp/Shapes.htm

They show ways to do this for certain objects which are centered at 0,0,0.

bloswald
04-07-2010, 07:13 AM
They show ways to do this for certain objects which are centered at 0,0,0.

Is there a way to do this for objects not centered at the origin? I am just curious about collideBoxes and collideSpheres mostly. I realize that showing a collideMesh might be difficult.

-
bloswald :)

Jeff
04-07-2010, 03:16 PM
You would have to adjust the position of the box or sphere used to visualize the collision area.

In the following example the avatar origin is at the bottom of his feet so the box does appear to be in the correct position. Hit the spacebar to adjust the position of the box.
import viz
viz.go()

viz.clearcolor(viz.SKYBLUE)

ground = viz.add('tut_ground.wrl')

logo = viz.add('logo.wrl',pos=[-1,1.5,6],euler=[0,0,30])
logo.collideBox()

logo.add('box.wrl',alpha=.2,scale=logo.getBounding Box(viz.REL_LOCAL).size)

avatar = viz.add('vcc_male.cfg',pos=[1,0,6],euler=[180,0,0])
avatar.collideBox()

box = avatar.add('box.wrl',alpha=.2,scale=avatar.getBoun dingBox(viz.REL_LOCAL).size)

vizact.onkeydown(' ',box.setPosition,[0,.9,0])

import vizcam
viz.cam.setHandler(vizcam.PivotNavigate(center=[0,1,6],distance=5))

The collideMesh area is the same as the object itself so it is not necessary to build anything to visualize it.