Vizard 7 » Command Index » Vizard modules » viz » <viz:phys>.setGravity
7.6

<viz:phys>.setGravity

Set's the gravity for a physics shape object.

<viz:phys>.setGravity(  
[x,y,z]  
)  
[x,y,z]
The gravity vector

Remarks

Setting this changes the default gravity of [0,-9.8,0].

Return Value

None

Example

floor = viz.add('tut_ground.wrl')
shape1 = floor.collidePlane()
ball = viz.add('ball.wrl')
shape = ball.collideSphere()
ball.setPosition(0,5,4)
viz.phys.setGravity(0,-2) #Sets the Y plane gravity to -2
vizact.onkeydown(' ', viz.phys.enable)