blob: 6eb445b825d80bc54a95b56abc4b09ebdf7adea6 (
plain) (
blame)
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
|
/*
* Graphyx
* copyright (c) 2009 Jakob Odersky
* made available under the MIT License
*/
package graphyx.tests
import sims.geometry._
import sims.dynamics._
import sims.dynamics.joints._
object Friction2 extends Test{
val title = "Friction2"
val world = new World {override val detector = new sims.collision.GridDetector(this) {gridSide = 0.2}}
def init = {
val shapes = for (i <- (0 to 20).toList) yield (new Rectangle(0.2, 0.1, 1) {
pos = Vector2D(0.4 * i, 0)
friction = (i * 1.0 / 10)
restitution = 0
})
val ground = new Body(shapes: _*) //Rectangle(100, 0.1, 1).asBody
ground.pos = Vector2D(0,0)
ground.fixed = true
ground.rotation = -0.2
world += ground
val b: Body = (new Circle(0.1,10)) ^ (new Circle(0.1,10) {pos = Vector2D(0.2,0)}) ^ (new Circle(0.1,10) {pos = Vector2D(0.4,0)})
b.pos = Vector2D(0.1,0.1)
world += b
}
}
|