![]() |
|
#1
|
|||
|
|||
|
Applying Gravity to a Mesh
Hi,
I am looking to use a mesh on a box and I need it to fall as if being acted on by gravity. What is the best way to trigger the fall action after the box has been picked up and keep the action occurring over a certain height? Also how do I make it stop falling whenever it collides with another object? This is the simple setup I have at the moment: Code:
import viz
import vizact
import vizconnect
import vizshape
viz.fov(60)
viz.go()
#fall action
fallAction=vizact.fall(0.75,gravity=9.81)
#adding ground
ground = viz.add('ground.osgb')
ground.collidePlane()
#add cubes
cube1=vizshape.addCube(size=0.5)
cube1.collidemesh()
cube1.setPosition(0,1,1)
cube1.add(fallAction)
cube2=viz.shape.addCube(size=0.5)
cube2.collidemesh()
cube2.setPosition(0,0.5,1)
#define grabbable parts
parts=[cube1]
#using vizconnect
vizconnect.go('vizconnect_config.py')
#grabber
grabber=vizconnect.getRawTool('grabber')
grabber.setItems(parts)
from tools import grabber
tool = grabber.Grabber(usingPhysics=True, usingSprings=True)
tool.setItems(parts)
Thanks |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Gravity changes with angle of view in mid-drop?! | GregEnj | Vizard | 1 | 08-07-2013 12:42 PM |
| Identify a class via its mesh | EnvisMJ | Vizard | 1 | 02-15-2012 09:43 AM |
| Collide mesh on child objects | Enlil | Vizard | 1 | 08-31-2010 06:52 PM |
| chain mesh collisions | mkmatlock | Vizard | 1 | 08-31-2010 01:44 PM |
| Multiple Mesh Avatar Texturing | v-jbinney | Vizard | 6 | 11-13-2007 12:00 PM |