Skip to content

Commit 29735d1

Browse files
committed
helloWorld ready
1 parent ae37a3b commit 29735d1

File tree

5 files changed

+22
-10
lines changed

5 files changed

+22
-10
lines changed

build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ repositories {
2727
mavenCentral()
2828
jcenter()
2929
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-dev") }
30-
maven { setUrl("https://kotlin.bintray.com/kotlin-eap-1.2") }
3130
maven { setUrl("https://jitpack.io") }
3231
}
3332

src/main/kotlin/bullet/collision/narrowPhaseCollision/GjkPairDetector.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ class GjkPairDetector(
106106
simplexSolver!!.reset()
107107

108108
while (true) {
109-
println("in")
110109
val seperatingAxisInA = (-cachedSeparatingAxis) * input.transformA.basis
111110
val seperatingAxisInB = cachedSeparatingAxis * input.transformB.basis
112111

src/main/kotlin/bullet/dynamics/constraintSolver/SequentialImpulseConstraintSolver.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class SequentialImpulseConstraintSolver : ConstraintSolver() {
9595
solverConstraint.solverBodyIdB = solverBodyIdB
9696

9797
solverConstraint.friction = cp.combinedFriction
98-
solverConstraint.originalContactPoint = 0
98+
solverConstraint.originalContactPoint = null
9999

100100
solverConstraint.appliedImpulse = 0f
101101
solverConstraint.appliedPushImpulse = 0f
@@ -185,7 +185,7 @@ class SequentialImpulseConstraintSolver : ConstraintSolver() {
185185
solverConstraint.solverBodyIdB = solverBodyIdB
186186

187187
solverConstraint.friction = combinedTorsionalFriction
188-
solverConstraint.originalContactPoint = 0
188+
solverConstraint.originalContactPoint = null
189189

190190
solverConstraint.appliedImpulse = 0f
191191
solverConstraint.appliedPushImpulse = 0f
@@ -1134,7 +1134,6 @@ class SequentialImpulseConstraintSolver : ConstraintSolver() {
11341134
///@todo: use stack allocator for such temporarily memory, same for solver bodies/constraints
11351135
resize(::orderNonContactConstraintPool, numNonContactPool)
11361136
val newSize = numConstraintPool * if (infoGlobal.solverMode has Sm.USE_2_FRICTION_DIRECTIONS) 2 else 1
1137-
println(newSize)
11381137
resize(::orderTmpConstraintPool, newSize)
11391138

11401139
resize(::orderFrictionConstraintPool, numFrictionPool)

src/main/kotlin/bullet/dynamics/constraintSolver/SolverConstraint.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ subject to the following restrictions:
1616
package bullet.dynamics.constraintSolver
1717

1818
import bullet.BYTES
19+
import bullet.collision.narrowPhaseCollision.ManifoldPoint
1920
import bullet.linearMath.Vec3
2021

2122
/** 1D constraint along a normal axis between bodyA and bodyB. It can be combined to solve contact and friction constraints. */
@@ -44,15 +45,18 @@ class SolverConstraint {
4445
var rhsPenetration = 0f
4546

4647
private var union: Any? = null
47-
var originalContactPoint: Any? = null
48+
var originalContactPoint
49+
get() = union
4850
set(value) {
4951
union = value
5052
}
51-
var unusedPadding4 = 0f
53+
var unusedPadding4
54+
get() = union as? Float
5255
set(value) {
5356
union = value
5457
}
55-
var numRowsForNonContactConstraint = 0
58+
var numRowsForNonContactConstraint
59+
get() = union as? Int
5660
set(value) {
5761
union = value
5862
}

src/test/kotlin/bullet/HelloWord.kt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,18 @@ import bullet.linearMath.DefaultMotionState
2828
import bullet.linearMath.Transform
2929
import bullet.linearMath.Vec3
3030
import io.kotlintest.matchers.shouldBe
31+
import io.kotlintest.specs.StringSpec
3132

3233
// This is a Hello World program for running a basic Bullet physics simulation
3334

34-
fun main(args: Array<String>) {
35+
class helloWorld : StringSpec() {
36+
37+
init {
38+
test()
39+
}
40+
}
41+
42+
fun test() {
3543

3644
// -----includes_end-----
3745

@@ -135,7 +143,10 @@ fun main(args: Array<String>) {
135143
if (j == 0)
136144
trans.origin shouldBe Vec3(0f, -56f, 0f)
137145
else
138-
println("[$i] world pos object $j = ${trans.origin.x},${trans.origin.y},${trans.origin.z}")
146+
println("[$i] world pos object $j = ${trans.origin.x}, ${trans.origin.y}, ${trans.origin.z}").also {
147+
if (i == 149)
148+
trans.origin shouldBe Vec3(2.000063f, -5.0000086f, 9.15244E-5f)
149+
}
139150
}
140151
}
141152

0 commit comments

Comments
 (0)