File: init_physics.lua

package info (click to toggle)
bullet 2.83.7%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 48,772 kB
  • sloc: cpp: 355,312; lisp: 12,087; ansic: 11,969; python: 644; makefile: 116; xml: 27
file content (66 lines) | stat: -rw-r--r-- 1,004 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
-- Very basic Lua script to create some Bullet objects. 
-- See also examples/LuaDemo


world = createDefaultDynamicsWorld()

cubeshape = createCubeShape(world, 30,1,30)
pos={0,0,0}
orn = {0,0,0,1}
mass = 0
body = createRigidBody(world,cubeshape,mass,pos,orn)

shape = createCubeShape(world, 1,1,1)

x=0
z=0
maxy = 10

toggle=1

for x=0,10 do
	for y=0,5 do
		if toggle==1 then
			toggle = 0
			for z=0,10 do
				mass = 1
				if (y==maxy) then
					--mass=30;
				end
				pos = {-14+x*2,2+2*y,z*2}
			
				body = createRigidBody(world,shape,mass,pos,orn)
				--setBodyPosition(world,body,pos)
				--setBodyOrientation(world,body,orn)
			end
		else
			toggle = 1
			
		end
	end
end

toggle=1
shape = createSphereShape(world, 1)

for x=0,10 do
	for y=0,5 do
		if toggle==1 then
			toggle = 0
		else
			toggle = 1
			for z=0,10 do
				mass = 1
				if (y==maxy) then
					--mass=30;
				end
			
			

				pos = {-14+x*2,2+2*y,z*2}
			
				body = createRigidBody(world,shape,mass,pos,orn)
			end
		end
	end
end