Programming Techniques

  1. Home
  2. Docs
  3. Programming Techniques
  4. Simulating Gravitation

Simulating Gravitation

Using variables we can simulate gravitation force on a given model. Let’s take a look at the following code:

s is a sphere having material="rock2"
var distance=0.4
do 21 times
s.move(y+distance) in 0.05 seconds
end do

First we create a Sphere then we move it 21 times along the Y axis, each time a slightly different distance which is initiated to 0.4 and reduced by 0.04 every iteration. This gives us the illusion of gravitation force applied on our 3d model.

Was this article helpful to you? Yes No

How can we help?