![]() |
#1
|
|||
|
|||
Gravity
Hello,
I have made a 2d array of pillars. I am trying to make all of these pillars drop to a certain plain. I am just a little confused about what I need to do. Below is the code that pertains to my nested for loops which create the pillars. I have looked into viz.gravity() and figured that is the best route. Just not sure where or really how to impliment this. Code:
columns = [-20, -10, 0, 10, 20] rows = [0, 6, 12, 18] pillars = [] for x in columns: #creates an array of pillars for y in rows: pillar = OrginalPillar.copy() pillar.translate(0+x, 0, 0+y) pillar.setScale(1,1,1) pillar.visible(viz.OFF) pillars.append(pillar) number = 0 def showPillar(): globae number pillars[number.visible(viz.ON) number += 1 vizact.ontimer2(.5,len(pillars)-1,showPillar) |
#2
|
|||
|
|||
The viz.gravity command changes the force of gravity on the viewpoint when viz.collision is on. This will not help you with your pillars =(
But, there's hope. You can use Vizard's physics engine to move the pillars. There are tutorials in Vizard's help that will get you started with the physics engine. If you just need the pillars to fall and sit there all nice and stable you could move them manually each frame with a timer and this physics function: yPosition = initialPosition + initialVelocity*secondsPassed + .5*gravitysAcceleration*secondsPassed*secondsPasse d For the pillars this function would probably look like this: yPosition = 0 + 0 + .5*-9.8*secondsPassed*secondsPassed
__________________
Paul Elliott WorldViz LLC |
![]() |
|
|