summaryrefslogtreecommitdiff
path: root/doc/examples/physics/script/test_fall.sq
blob: 79526da8b461cfc647291880e1b657189fb30148 (plain)
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

include("test_base.sq") 

class TestFall extends PhysicsTestBase {


	fall_elements=10

	function init_internal() {

		for (local i=0;i<10;i++) {

			local shape_idx=[
				PhysicsServer.SHAPE_SPHERE,
				PhysicsServer.SHAPE_BOX,
				PhysicsServer.SHAPE_CAPSULE,
				PhysicsServer.SHAPE_CYLINDER,
				PhysicsServer.SHAPE_CONVEX_POLYGON
			];

			local stype=shape_idx[i%5];
//			stype=PhysicsServer.SHAPE_SPHERE;

			local t=Transform()
			t.set_origin(Vector3(-0.7+0.0*i,3.5+4.1*i,0))
			t.rotate_basis(Vector3(1,0,0),Math.PI/4*i)

			local b = create_body(stype,PhysicsServer.BODY_MODE_RIGID,t);

		}

		create_static_plane( Plane( Vector3(0,1,0), -1) );

	}

	constructor() {
		PhysicsTestBase.constructor()
	}
}  


return TestFall