pbox2d 0.4.2-java → 0.5.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +15 -0
- data/CHANGELOG.md +37 -0
- data/CONTRIBUTING.md +30 -0
- data/Gemfile +4 -0
- data/LICENCE +25 -0
- data/LICENSE.md +1 -3
- data/README.md +3 -3
- data/Rakefile +19 -81
- data/examples/README.md +7 -0
- data/examples/bumpy_surface_noise.rb +11 -7
- data/examples/collision_listening.rb +30 -0
- data/examples/data/java_args.txt +2 -0
- data/examples/distance_joint/distance_joint.rb +8 -5
- data/examples/lib/boundary.rb +22 -13
- data/examples/lib/box.rb +1 -2
- data/examples/lib/custom_listener.rb +29 -0
- data/examples/lib/custom_shape.rb +5 -3
- data/examples/lib/particle.rb +77 -0
- data/examples/lib/particle_system.rb +25 -65
- data/examples/lib/shape_system.rb +5 -3
- data/examples/lib/surface.rb +1 -1
- data/examples/liquid_fun_test.rb +11 -5
- data/examples/liquidy.rb +18 -14
- data/examples/mouse_joint/boundary.rb +1 -1
- data/examples/mouse_joint/box.rb +1 -1
- data/examples/mouse_joint/dummy_spring.rb +2 -3
- data/examples/mouse_joint/mouse_joint.rb +7 -8
- data/examples/polygons.rb +16 -16
- data/examples/quick_test.rb +33 -63
- data/examples/revolute_joint/revolute_joint.rb +5 -1
- data/examples/test_contact/README.md +6 -0
- data/examples/test_contact/lib/boundary.rb +1 -1
- data/examples/test_contact/lib/particle.rb +3 -3
- data/examples/test_contact/test_contact.rb +2 -1
- data/lib/box2d.jar +0 -0
- data/lib/jbox2d-library-2.3.1-SNAPSHOT.jar +0 -0
- data/lib/pbox2d/box2d.rb +1 -1
- data/lib/pbox2d/version.rb +2 -3
- data/pbox2d.gemspec +33 -0
- data/pom.xml +146 -0
- data/src/processing/box2d/Box2DProcessing.java +319 -0
- data/src/processing/box2d/Options.java +52 -0
- data/src/processing/box2d/Step.java +44 -0
- metadata +46 -34
- data/lib/jbox2d-library-2.2.1-ds.jar +0 -0
data/pom.xml
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
3
|
+
<modelVersion>4.0.0</modelVersion>
|
4
|
+
<groupId>org.ruby-processing</groupId>
|
5
|
+
<artifactId>box2d</artifactId>
|
6
|
+
<version>0.5.0-SNAPSHOT</version>
|
7
|
+
<packaging>jar</packaging>
|
8
|
+
<description>
|
9
|
+
jbox2d-library for JRubyArt
|
10
|
+
</description>
|
11
|
+
|
12
|
+
<parent>
|
13
|
+
<groupId>org.sonatype.oss</groupId>
|
14
|
+
<artifactId>oss-parent</artifactId>
|
15
|
+
<version>7</version>
|
16
|
+
</parent>
|
17
|
+
|
18
|
+
<issueManagement>
|
19
|
+
<system>Github</system>
|
20
|
+
<url>https://github.com/ruby-processing/jbox2d/issues</url>
|
21
|
+
</issueManagement>
|
22
|
+
|
23
|
+
<scm>
|
24
|
+
<connection>scm:git:git://github.com/ruby-processing/jbox2d.git</connection>
|
25
|
+
<developerConnection>scm:git:git@github.com:ruby-processing/jbox2d.git</developerConnection>
|
26
|
+
<url>https://github.com/ruby-processing/jbox2d</url>
|
27
|
+
</scm>
|
28
|
+
|
29
|
+
<licenses>
|
30
|
+
<license>
|
31
|
+
<name>Simplified BSD License</name>
|
32
|
+
<url>http://www.opensource.org/licenses/bsd-license.php</url>
|
33
|
+
</license>
|
34
|
+
</licenses>
|
35
|
+
|
36
|
+
<developers>
|
37
|
+
<developer>
|
38
|
+
<id>monkstone</id>
|
39
|
+
<name>Martin Prout</name>
|
40
|
+
<email>martin_p@lineone.net</email>
|
41
|
+
</developer>
|
42
|
+
</developers>
|
43
|
+
|
44
|
+
<dependencies>
|
45
|
+
<dependency>
|
46
|
+
<groupId>org.jbox2d</groupId>
|
47
|
+
<artifactId>jbox2d-library</artifactId>
|
48
|
+
<version>2.3.1-SNAPSHOT</version>
|
49
|
+
</dependency>
|
50
|
+
<dependency>
|
51
|
+
<groupId>org.processing</groupId>
|
52
|
+
<artifactId>core</artifactId>
|
53
|
+
<scope>system</scope>
|
54
|
+
<version>3.0.1</version>
|
55
|
+
<systemPath>${processing.home}/core/library/core.jar</systemPath>
|
56
|
+
</dependency>
|
57
|
+
</dependencies>
|
58
|
+
<properties>
|
59
|
+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
60
|
+
<maven.compiler.source>1.8</maven.compiler.source>
|
61
|
+
<maven.compiler.target>1.8</maven.compiler.target>
|
62
|
+
<!-- for Mac developers, non Archlinux and Windows can probably figure it out
|
63
|
+
<processing.home>/Applications/Processing.app/Contents/Java</processing.home>
|
64
|
+
-->
|
65
|
+
<processing.home>/usr/share/processing</processing.home>
|
66
|
+
</properties>
|
67
|
+
<build>
|
68
|
+
<sourceDirectory>src</sourceDirectory>
|
69
|
+
<finalName>box2d</finalName>
|
70
|
+
<extensions>
|
71
|
+
<extension>
|
72
|
+
<groupId>org.apache.maven.wagon</groupId>
|
73
|
+
<artifactId>wagon-webdav-jackrabbit</artifactId>
|
74
|
+
<version>2.1</version>
|
75
|
+
</extension>
|
76
|
+
</extensions>
|
77
|
+
<plugins>
|
78
|
+
<plugin>
|
79
|
+
<artifactId>maven-source-plugin</artifactId>
|
80
|
+
<version>2.2.1</version>
|
81
|
+
<executions>
|
82
|
+
<execution>
|
83
|
+
<id>attach-sources</id>
|
84
|
+
<goals>
|
85
|
+
<goal>jar</goal>
|
86
|
+
</goals>
|
87
|
+
</execution>
|
88
|
+
</executions>
|
89
|
+
</plugin>
|
90
|
+
<plugin>
|
91
|
+
<artifactId>maven-javadoc-plugin</artifactId>
|
92
|
+
<version>2.9</version>
|
93
|
+
<executions>
|
94
|
+
<execution>
|
95
|
+
<id>attach-javadocs</id>
|
96
|
+
<goals>
|
97
|
+
<goal>jar</goal>
|
98
|
+
</goals>
|
99
|
+
</execution>
|
100
|
+
</executions>
|
101
|
+
</plugin>
|
102
|
+
<plugin>
|
103
|
+
<artifactId>maven-compiler-plugin</artifactId>
|
104
|
+
<version>3.1</version>
|
105
|
+
<configuration>
|
106
|
+
<source>1.8</source>
|
107
|
+
<target>1.8</target>
|
108
|
+
</configuration>
|
109
|
+
</plugin>
|
110
|
+
<plugin>
|
111
|
+
<artifactId>maven-jar-plugin</artifactId>
|
112
|
+
<version>2.4</version>
|
113
|
+
<configuration>
|
114
|
+
<archive>
|
115
|
+
<manifestFile>MANIFEST.MF</manifestFile>
|
116
|
+
</archive>
|
117
|
+
</configuration>
|
118
|
+
</plugin>
|
119
|
+
<plugin>
|
120
|
+
<artifactId>maven-resources-plugin</artifactId>
|
121
|
+
<version>2.6</version>
|
122
|
+
</plugin>
|
123
|
+
<plugin>
|
124
|
+
<groupId>org.apache.maven.plugins</groupId>
|
125
|
+
<artifactId>maven-dependency-plugin</artifactId>
|
126
|
+
<version>2.10</version>
|
127
|
+
<executions>
|
128
|
+
<execution>
|
129
|
+
<id>default-cli</id>
|
130
|
+
<configuration>
|
131
|
+
<artifactItems>
|
132
|
+
<artifactItem>
|
133
|
+
<groupId>org.jbox2d</groupId>
|
134
|
+
<artifactId>jbox2d-library</artifactId>
|
135
|
+
<version>2.3.1-SNAPSHOT</version>
|
136
|
+
<type>jar</type>
|
137
|
+
<outputDirectory>lib</outputDirectory>
|
138
|
+
</artifactItem>
|
139
|
+
</artifactItems>
|
140
|
+
</configuration>
|
141
|
+
</execution>
|
142
|
+
</executions>
|
143
|
+
</plugin>
|
144
|
+
</plugins>
|
145
|
+
</build>
|
146
|
+
</project>
|
@@ -0,0 +1,319 @@
|
|
1
|
+
package processing.box2d;
|
2
|
+
|
3
|
+
import org.jbox2d.common.Transform;
|
4
|
+
import org.jbox2d.common.Vec2;
|
5
|
+
import org.jbox2d.dynamics.Body;
|
6
|
+
import org.jbox2d.dynamics.BodyDef;
|
7
|
+
import org.jbox2d.dynamics.World;
|
8
|
+
import org.jbox2d.dynamics.joints.Joint;
|
9
|
+
import org.jbox2d.dynamics.joints.JointDef;
|
10
|
+
|
11
|
+
import processing.core.PApplet;
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Loosely based on Box2D-for-processing by Dan Shiffman
|
15
|
+
*
|
16
|
+
* @author Martin Prout
|
17
|
+
*/
|
18
|
+
public abstract class Box2DProcessing {
|
19
|
+
|
20
|
+
private final PApplet parent;
|
21
|
+
private Options options;
|
22
|
+
private Step stepO;
|
23
|
+
private final float height;
|
24
|
+
private final float width;
|
25
|
+
/**
|
26
|
+
* The Box2D world (we might need public access for our ContactListener)
|
27
|
+
*/
|
28
|
+
protected World world;
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Scale between processing sketch and physics world
|
32
|
+
*/
|
33
|
+
private float scaleFactor;// = 10.0f;
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Adjust for processing.org unfathomable choice of y-axis direction
|
37
|
+
*/
|
38
|
+
private final float yFlip;// = -1.0f; //flip y coordinate
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Controls access to processing pre loop (via reflection)
|
42
|
+
*/
|
43
|
+
private boolean isActive = false;
|
44
|
+
|
45
|
+
private Body groundBody;
|
46
|
+
|
47
|
+
/**
|
48
|
+
*
|
49
|
+
* @param p PApplet
|
50
|
+
*/
|
51
|
+
public Box2DProcessing(PApplet p) {
|
52
|
+
parent = p;
|
53
|
+
height = p.height;
|
54
|
+
width = p.width;
|
55
|
+
yFlip = -1;
|
56
|
+
setActive(true);
|
57
|
+
}
|
58
|
+
|
59
|
+
/**
|
60
|
+
* Abstract method implement on ruby side
|
61
|
+
*
|
62
|
+
* @param listener Custom Listener, Sketch?
|
63
|
+
*/
|
64
|
+
public abstract void addListener(org.jbox2d.callbacks.ContactListener listener);
|
65
|
+
|
66
|
+
/**
|
67
|
+
*
|
68
|
+
* @param scale float
|
69
|
+
* @param gravity float[]
|
70
|
+
* @param warmStart boolean
|
71
|
+
* @param continuous boolean
|
72
|
+
*/
|
73
|
+
protected void setOptions(float scale, float[] gravity, boolean warmStart, boolean continuous) {
|
74
|
+
options = new Options(scale, gravity, warmStart, continuous);
|
75
|
+
}
|
76
|
+
|
77
|
+
/**
|
78
|
+
*
|
79
|
+
* @param timeStep float
|
80
|
+
* @param velocity int
|
81
|
+
* @param position int
|
82
|
+
*/
|
83
|
+
protected void setStep(float timeStep, int velocity, int position) {
|
84
|
+
stepO = new Step(timeStep, velocity, position);
|
85
|
+
}
|
86
|
+
|
87
|
+
/**
|
88
|
+
* This is the all important physics "step" function Says to move ahead one
|
89
|
+
* unit in time Default
|
90
|
+
*/
|
91
|
+
protected void step() {
|
92
|
+
if (stepO == null) {
|
93
|
+
stepO = new Step();
|
94
|
+
}
|
95
|
+
world.step(stepO.timeStep, stepO.velIters, stepO.posIters);
|
96
|
+
world.clearForces();
|
97
|
+
}
|
98
|
+
|
99
|
+
/**
|
100
|
+
* Create a world
|
101
|
+
*/
|
102
|
+
public void createWorld() {
|
103
|
+
if (options == null) {
|
104
|
+
options = new Options();
|
105
|
+
}
|
106
|
+
Vec2 gravity = new Vec2(options.gravity[0], options.gravity[1]);
|
107
|
+
scaleFactor = options.scaleFactor;
|
108
|
+
world = new World(gravity);
|
109
|
+
world.setWarmStarting(options.warm);
|
110
|
+
world.setContinuousPhysics(options.continuous);
|
111
|
+
BodyDef bodyDef = new BodyDef();
|
112
|
+
groundBody = world.createBody(bodyDef);
|
113
|
+
}
|
114
|
+
|
115
|
+
/**
|
116
|
+
*
|
117
|
+
* @return Body
|
118
|
+
*/
|
119
|
+
public Body groundBody() {
|
120
|
+
return groundBody;
|
121
|
+
}
|
122
|
+
|
123
|
+
/**
|
124
|
+
* Set the gravity (this can change in real-time)
|
125
|
+
*
|
126
|
+
* @param gravity float[]
|
127
|
+
*/
|
128
|
+
protected void changeGravity(float[] gravity) {
|
129
|
+
world.setGravity(new Vec2(gravity[0], gravity[1]));
|
130
|
+
}
|
131
|
+
|
132
|
+
/**
|
133
|
+
* Box2d has its own coordinate system and we have to move back and forth
|
134
|
+
* between them to convert from Box2d world to processing pixel space
|
135
|
+
*
|
136
|
+
* @param world Vec2
|
137
|
+
* @return Vec2
|
138
|
+
*/
|
139
|
+
public Vec2 worldToProcessing(Vec2 world) {
|
140
|
+
return worldToProcessing(world.x, world.y);
|
141
|
+
}
|
142
|
+
|
143
|
+
/**
|
144
|
+
* Box2d has its own coordinate system and we have to move back and forth
|
145
|
+
* between them to convert from Box2d world to processing pixel space
|
146
|
+
* Note reverse Y mapping (processing poxy coord system again)
|
147
|
+
* @param worldX float
|
148
|
+
* @param worldY float
|
149
|
+
* @return Vec2
|
150
|
+
*/
|
151
|
+
public Vec2 worldToProcessing(float worldX, float worldY) {
|
152
|
+
float pixelX = map(worldX, 0f, 1f, parent.width / 2, parent.width / 2 + scaleFactor);
|
153
|
+
float pixelY = map(worldY, 1f, 0f, parent.height / 2, parent.height / 2 + scaleFactor);
|
154
|
+
return new Vec2(pixelX, pixelY);
|
155
|
+
}
|
156
|
+
|
157
|
+
/**
|
158
|
+
* convert Coordinate from pixel space to box2d world
|
159
|
+
*
|
160
|
+
* @param screen Vec2
|
161
|
+
* @return Vec2
|
162
|
+
*/
|
163
|
+
public Vec2 processingToWorld(Vec2 screen) {
|
164
|
+
return processingToWorld(screen.x, screen.y);
|
165
|
+
}
|
166
|
+
|
167
|
+
/**
|
168
|
+
* Note reverse Y mapping (processing poxy coord system again)
|
169
|
+
* @param pixelX float
|
170
|
+
* @param pixelY float
|
171
|
+
* @return Vec2
|
172
|
+
*/
|
173
|
+
public Vec2 processingToWorld(float pixelX, float pixelY) {
|
174
|
+
float worldX = map(pixelX, parent.width / 2, parent.width / 2 + scaleFactor, 0f, 1f);
|
175
|
+
float worldY = map(pixelY, parent.height / 2, parent.height / 2 + scaleFactor, 1f, 0f);
|
176
|
+
return new Vec2(worldX, worldY);
|
177
|
+
}
|
178
|
+
|
179
|
+
/**
|
180
|
+
* Scale from processing to world
|
181
|
+
*
|
182
|
+
* @param val float
|
183
|
+
* @return float
|
184
|
+
*/
|
185
|
+
public float scaleToWorld(float val) {
|
186
|
+
return val / scaleFactor;
|
187
|
+
}
|
188
|
+
|
189
|
+
/**
|
190
|
+
* Scale from world to processing
|
191
|
+
*
|
192
|
+
* @param val float
|
193
|
+
* @return float
|
194
|
+
*/
|
195
|
+
public float scaleToProcessing(float val) {
|
196
|
+
return val * scaleFactor;
|
197
|
+
}
|
198
|
+
|
199
|
+
/**
|
200
|
+
* Vector scale between two worlds
|
201
|
+
*
|
202
|
+
* @param v Vec2
|
203
|
+
* @return Vec2
|
204
|
+
*/
|
205
|
+
public Vec2 vectorToWorld(Vec2 v) {
|
206
|
+
Vec2 u = new Vec2(v.x / scaleFactor, v.y / scaleFactor);
|
207
|
+
u.y *= yFlip;
|
208
|
+
return u;
|
209
|
+
}
|
210
|
+
|
211
|
+
/**
|
212
|
+
* Translate from world coords to processing as a Vec2
|
213
|
+
*
|
214
|
+
* @param x float
|
215
|
+
* @param y float
|
216
|
+
* @return Vec
|
217
|
+
*/
|
218
|
+
public Vec2 vectorToWorld(float x, float y) {
|
219
|
+
Vec2 u = new Vec2(x / scaleFactor, y / scaleFactor);
|
220
|
+
u.y *= yFlip;
|
221
|
+
return u;
|
222
|
+
}
|
223
|
+
|
224
|
+
/**
|
225
|
+
* Translate from world to processing as a Vec2
|
226
|
+
*
|
227
|
+
* @param v Vec
|
228
|
+
* @return Vec
|
229
|
+
*/
|
230
|
+
public Vec2 vectorToProcessing(Vec2 v) {
|
231
|
+
Vec2 u = new Vec2(v.x * scaleFactor, v.y * scaleFactor);
|
232
|
+
u.y *= yFlip;
|
233
|
+
return u;
|
234
|
+
}
|
235
|
+
|
236
|
+
/**
|
237
|
+
* A common task we have to do a lot
|
238
|
+
*
|
239
|
+
* @param bd BodyDef
|
240
|
+
* @return Body
|
241
|
+
*/
|
242
|
+
public Body createBody(BodyDef bd) {
|
243
|
+
return world.createBody(bd);
|
244
|
+
}
|
245
|
+
|
246
|
+
/**
|
247
|
+
* A common task we have to do a lot
|
248
|
+
*
|
249
|
+
* @param jd JointDef
|
250
|
+
* @return World
|
251
|
+
*/
|
252
|
+
public Joint createJoint(JointDef jd) {
|
253
|
+
return world.createJoint(jd);
|
254
|
+
}
|
255
|
+
|
256
|
+
/**
|
257
|
+
*
|
258
|
+
* @param b Body
|
259
|
+
* @return body coord as Vec2
|
260
|
+
*/
|
261
|
+
public Vec2 bodyCoord(Body b) {
|
262
|
+
Transform xf = b.getTransform();
|
263
|
+
return worldToProcessing(xf.p);
|
264
|
+
}
|
265
|
+
|
266
|
+
/**
|
267
|
+
*
|
268
|
+
* @param b Body
|
269
|
+
*/
|
270
|
+
public void destroyBody(Body b) {
|
271
|
+
world.destroyBody(b);
|
272
|
+
}
|
273
|
+
|
274
|
+
/**
|
275
|
+
* Access the processing pre loop by java reflection
|
276
|
+
*/
|
277
|
+
public void pre() {
|
278
|
+
step();
|
279
|
+
}
|
280
|
+
|
281
|
+
/**
|
282
|
+
* Recommended inclusion in a processing library
|
283
|
+
*/
|
284
|
+
public void dispose() {
|
285
|
+
setActive(false);
|
286
|
+
}
|
287
|
+
|
288
|
+
/**
|
289
|
+
*
|
290
|
+
* @return height float
|
291
|
+
*/
|
292
|
+
public float height() {
|
293
|
+
return height;
|
294
|
+
}
|
295
|
+
|
296
|
+
/**
|
297
|
+
*
|
298
|
+
* @return width float
|
299
|
+
*/
|
300
|
+
public float width() {
|
301
|
+
return width;
|
302
|
+
}
|
303
|
+
|
304
|
+
private float map(float val, float startIn, float endIn, float startOut, float endOut) {
|
305
|
+
return startOut + (endOut - startOut) * ((val - startIn) / (endIn - startIn));
|
306
|
+
}
|
307
|
+
|
308
|
+
private void setActive(boolean active) {
|
309
|
+
if (active != isActive) {
|
310
|
+
isActive = active;
|
311
|
+
if (active) {
|
312
|
+
parent.registerMethod("dispose", this);
|
313
|
+
parent.registerMethod("pre", this);
|
314
|
+
} else {
|
315
|
+
parent.unregisterMethod("pre", this);
|
316
|
+
}
|
317
|
+
}
|
318
|
+
}
|
319
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
package processing.box2d;
|
2
|
+
|
3
|
+
/**
|
4
|
+
*
|
5
|
+
* @author Martin Prout
|
6
|
+
*/
|
7
|
+
public class Options {
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Continuous physics
|
11
|
+
*/
|
12
|
+
public final boolean continuous;
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Warm start
|
16
|
+
*/
|
17
|
+
public final boolean warm;
|
18
|
+
|
19
|
+
/**
|
20
|
+
* gravity as an array of float
|
21
|
+
*/
|
22
|
+
public final float[] gravity;
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Factor to scale between physics world and sketch
|
26
|
+
*/
|
27
|
+
public final float scaleFactor;
|
28
|
+
|
29
|
+
/**
|
30
|
+
*
|
31
|
+
* @param scaleFactor float
|
32
|
+
* @param gravity float[]
|
33
|
+
* @param warmStart boolean
|
34
|
+
* @param continuousPhysics boolean
|
35
|
+
*/
|
36
|
+
public Options(float scaleFactor, float[] gravity, boolean warmStart, boolean continuousPhysics) {
|
37
|
+
this.scaleFactor = scaleFactor;
|
38
|
+
this.gravity = gravity;
|
39
|
+
this.warm = warmStart;
|
40
|
+
this.continuous = continuousPhysics;
|
41
|
+
}
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Default Options constructor
|
45
|
+
*/
|
46
|
+
public Options() {
|
47
|
+
this.scaleFactor = 10f;
|
48
|
+
this.gravity = new float[]{0, -10f};
|
49
|
+
this.warm = true;
|
50
|
+
this.continuous = true;
|
51
|
+
}
|
52
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
package processing.box2d;
|
2
|
+
|
3
|
+
/**
|
4
|
+
*
|
5
|
+
* @author Martin Prout
|
6
|
+
*/
|
7
|
+
public class Step {
|
8
|
+
|
9
|
+
/**
|
10
|
+
* time of step typically set to once per draw loop
|
11
|
+
*/
|
12
|
+
public float timeStep;
|
13
|
+
|
14
|
+
/**
|
15
|
+
* No of velocity iterations
|
16
|
+
*/
|
17
|
+
public int velIters;
|
18
|
+
|
19
|
+
/**
|
20
|
+
* No of position iterations
|
21
|
+
*/
|
22
|
+
public int posIters;
|
23
|
+
|
24
|
+
/**
|
25
|
+
*
|
26
|
+
* @param timeStep float
|
27
|
+
* @param velIterations int
|
28
|
+
* @param posIterations int
|
29
|
+
*/
|
30
|
+
public Step(float timeStep, int velIterations, int posIterations) {
|
31
|
+
this.timeStep = timeStep;
|
32
|
+
this.velIters = velIterations;
|
33
|
+
this.posIters = posIterations;
|
34
|
+
}
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Step constructor with defaults
|
38
|
+
*/
|
39
|
+
public Step() {
|
40
|
+
this.timeStep = 1.0f / 60;
|
41
|
+
this.velIters = 8;
|
42
|
+
this.posIters = 10;
|
43
|
+
}
|
44
|
+
}
|