WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Gravity (https://forum.worldviz.com/showthread.php?t=1878)

durf 03-03-2009 09:36 AM

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)


Gladsomebeast 03-04-2009 11:47 AM

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


All times are GMT -7. The time now is 05:41 AM.

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