WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Show Physics Shapes (https://forum.worldviz.com/showthread.php?t=2675)

bloswald 04-06-2010 07:40 AM

Show Physics Shapes
 
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

Quote:

Originally Posted by Jeff (Post 9821)
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.
Code:

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.getBoundingBox(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.getBoundingBox(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.


All times are GMT -7. The time now is 11:18 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC