diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..8a0a60d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+# Project exclude paths
+/.gradle/
+/build/
+/build/classes/java/main/
\ No newline at end of file
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/JmeCarPhysicsTestRPI.iml b/.idea/JmeCarPhysicsTestRPI.iml
new file mode 100644
index 0000000..9b6d0d5
--- /dev/null
+++ b/.idea/JmeCarPhysicsTestRPI.iml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
new file mode 100644
index 0000000..4e763b0
Binary files /dev/null and b/.idea/caches/build_file_checksums.ser differ
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..3f67f9c
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,157 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ xmlns:android
+ ^$
+
+
+
+
+
+
+
+
+ xmlns:.*
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*:id
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ .*:name
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ name
+ ^$
+
+
+
+
+
+
+
+
+ style
+ ^$
+
+
+
+
+
+
+
+
+ .*
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*
+ http://schemas.android.com/apk/res/android
+
+
+ ANDROID_ATTRIBUTE_ORDER
+
+
+
+
+
+
+ .*
+ .*
+
+
+ BY_NAME
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..a55e7a1
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..61a9130
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..15767b2
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..942efa6
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_github_Scrappers_glitch_JoystickModule_1_0_9R.xml b/.idea/libraries/Gradle__com_github_Scrappers_glitch_JoystickModule_1_0_9R.xml
new file mode 100644
index 0000000..af7d977
--- /dev/null
+++ b/.idea/libraries/Gradle__com_github_Scrappers_glitch_JoystickModule_1_0_9R.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_github_stephengold_Heart_6_2_0.xml b/.idea/libraries/Gradle__com_github_stephengold_Heart_6_2_0.xml
new file mode 100644
index 0000000..9b08cc7
--- /dev/null
+++ b/.idea/libraries/Gradle__com_github_stephengold_Heart_6_2_0.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_github_stephengold_Minie_3_1_0.xml b/.idea/libraries/Gradle__com_github_stephengold_Minie_3_1_0.xml
new file mode 100644
index 0000000..9dc6d6b
--- /dev/null
+++ b/.idea/libraries/Gradle__com_github_stephengold_Minie_3_1_0.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_pi4j_pi4j_core_1_2.xml b/.idea/libraries/Gradle__com_pi4j_pi4j_core_1_2.xml
new file mode 100644
index 0000000..e38dd69
--- /dev/null
+++ b/.idea/libraries/Gradle__com_pi4j_pi4j_core_1_2.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_pi4j_pi4j_device_1_2.xml b/.idea/libraries/Gradle__com_pi4j_pi4j_device_1_2.xml
new file mode 100644
index 0000000..ca2eaff
--- /dev/null
+++ b/.idea/libraries/Gradle__com_pi4j_pi4j_device_1_2.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_pi4j_pi4j_gpio_extension_1_2.xml b/.idea/libraries/Gradle__com_pi4j_pi4j_gpio_extension_1_2.xml
new file mode 100644
index 0000000..cb3903c
--- /dev/null
+++ b/.idea/libraries/Gradle__com_pi4j_pi4j_gpio_extension_1_2.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__junit_junit_4_12.xml b/.idea/libraries/Gradle__junit_junit_4_12.xml
new file mode 100644
index 0000000..1245ee7
--- /dev/null
+++ b/.idea/libraries/Gradle__junit_junit_4_12.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml
new file mode 100644
index 0000000..8262f72
--- /dev/null
+++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_jmonkeyengine_jme3_core_3_3_2_stable.xml b/.idea/libraries/Gradle__org_jmonkeyengine_jme3_core_3_3_2_stable.xml
new file mode 100644
index 0000000..7a5d0d9
--- /dev/null
+++ b/.idea/libraries/Gradle__org_jmonkeyengine_jme3_core_3_3_2_stable.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_jmonkeyengine_jme3_desktop_3_3_2_stable.xml b/.idea/libraries/Gradle__org_jmonkeyengine_jme3_desktop_3_3_2_stable.xml
new file mode 100644
index 0000000..589796c
--- /dev/null
+++ b/.idea/libraries/Gradle__org_jmonkeyengine_jme3_desktop_3_3_2_stable.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_jmonkeyengine_jme3_lwjgl3_3_3_2_stable.xml b/.idea/libraries/Gradle__org_jmonkeyengine_jme3_lwjgl3_3_3_2_stable.xml
new file mode 100644
index 0000000..fa93df4
--- /dev/null
+++ b/.idea/libraries/Gradle__org_jmonkeyengine_jme3_lwjgl3_3_3_2_stable.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_jmonkeyengine_jme3_terrain_3_3_2_stable.xml b/.idea/libraries/Gradle__org_jmonkeyengine_jme3_terrain_3_3_2_stable.xml
new file mode 100644
index 0000000..5800396
--- /dev/null
+++ b/.idea/libraries/Gradle__org_jmonkeyengine_jme3_terrain_3_3_2_stable.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_3_2_3.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_3_2_3.xml
new file mode 100644
index 0000000..4dd0d82
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_3_2_3.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_3_2_3_natives_linux.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_3_2_3_natives_linux.xml
new file mode 100644
index 0000000..9893f37
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_3_2_3_natives_linux.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_3_2_3_natives_linux_arm32.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_3_2_3_natives_linux_arm32.xml
new file mode 100644
index 0000000..7373b37
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_3_2_3_natives_linux_arm32.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_3_2_3_natives_macos.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_3_2_3_natives_macos.xml
new file mode 100644
index 0000000..dfd4093
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_3_2_3_natives_macos.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_3_2_3_natives_windows.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_3_2_3_natives_windows.xml
new file mode 100644
index 0000000..12e3716
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_3_2_3_natives_windows.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_glfw_3_2_3.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_glfw_3_2_3.xml
new file mode 100644
index 0000000..b2b93a5
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_glfw_3_2_3.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_glfw_3_2_3_natives_linux.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_glfw_3_2_3_natives_linux.xml
new file mode 100644
index 0000000..2470313
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_glfw_3_2_3_natives_linux.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_glfw_3_2_3_natives_macos.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_glfw_3_2_3_natives_macos.xml
new file mode 100644
index 0000000..ed65e24
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_glfw_3_2_3_natives_macos.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_glfw_3_2_3_natives_windows.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_glfw_3_2_3_natives_windows.xml
new file mode 100644
index 0000000..f912eb4
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_glfw_3_2_3_natives_windows.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_jemalloc_3_2_3.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_jemalloc_3_2_3.xml
new file mode 100644
index 0000000..4e9c356
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_jemalloc_3_2_3.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_jemalloc_3_2_3_natives_linux.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_jemalloc_3_2_3_natives_linux.xml
new file mode 100644
index 0000000..35a7326
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_jemalloc_3_2_3_natives_linux.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_jemalloc_3_2_3_natives_macos.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_jemalloc_3_2_3_natives_macos.xml
new file mode 100644
index 0000000..297c2a8
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_jemalloc_3_2_3_natives_macos.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_jemalloc_3_2_3_natives_windows.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_jemalloc_3_2_3_natives_windows.xml
new file mode 100644
index 0000000..88471b4
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_jemalloc_3_2_3_natives_windows.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_openal_3_2_3.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_openal_3_2_3.xml
new file mode 100644
index 0000000..63998f8
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_openal_3_2_3.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_openal_3_2_3_natives_linux.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_openal_3_2_3_natives_linux.xml
new file mode 100644
index 0000000..7d0c97f
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_openal_3_2_3_natives_linux.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_openal_3_2_3_natives_macos.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_openal_3_2_3_natives_macos.xml
new file mode 100644
index 0000000..75266ed
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_openal_3_2_3_natives_macos.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_openal_3_2_3_natives_windows.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_openal_3_2_3_natives_windows.xml
new file mode 100644
index 0000000..e51d0d5
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_openal_3_2_3_natives_windows.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_opencl_3_2_3.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_opencl_3_2_3.xml
new file mode 100644
index 0000000..aab0a81
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_opencl_3_2_3.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_opengl_3_2_3.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_opengl_3_2_3.xml
new file mode 100644
index 0000000..aa3544f
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_opengl_3_2_3.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_opengl_3_2_3_natives_linux.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_opengl_3_2_3_natives_linux.xml
new file mode 100644
index 0000000..d19f93a
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_opengl_3_2_3_natives_linux.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_opengl_3_2_3_natives_macos.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_opengl_3_2_3_natives_macos.xml
new file mode 100644
index 0000000..cb7601d
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_opengl_3_2_3_natives_macos.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_lwjgl_lwjgl_opengl_3_2_3_natives_windows.xml b/.idea/libraries/Gradle__org_lwjgl_lwjgl_opengl_3_2_3_natives_windows.xml
new file mode 100644
index 0000000..a790b18
--- /dev/null
+++ b/.idea/libraries/Gradle__org_lwjgl_lwjgl_opengl_3_2_3_natives_windows.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..794aa67
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..4be5757
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AttachedImages/2021-01-29-143234_1920x1080_scrot.png b/AttachedImages/2021-01-29-143234_1920x1080_scrot.png
new file mode 100755
index 0000000..35e7182
Binary files /dev/null and b/AttachedImages/2021-01-29-143234_1920x1080_scrot.png differ
diff --git a/build.gradle b/build.gradle
new file mode 100755
index 0000000..1dd5d63
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,50 @@
+plugins {
+ id 'java'
+}
+
+group 'com.scrappers'
+version '3.0-TestCase'
+
+sourceCompatibility = 1.8
+
+repositories {
+ mavenCentral()
+ /*add repositories of jcenter,bintray,jtpack.io*/
+ jcenter()
+ maven { url 'https://jitpack.io' }
+
+}
+
+dependencies {
+ testCompile group: 'junit', name: 'junit', version: '4.12'
+
+ /**jme3 core libraries from jcenter & Miniev3.1.0 for arm32 or armhf or armv7l or cortex-A(application)72 that runs on raspiberry pi4 model b*/
+
+ implementation "org.jmonkeyengine:jme3-core:3.3.2-stable"
+ implementation "org.jmonkeyengine:jme3-lwjgl3:3.3.2-stable"
+ implementation "org.jmonkeyengine:jme3-desktop:3.3.2-stable"
+ implementation 'com.github.stephengold:Minie:3.1.0'
+
+ /**don't forget this in order to extract the native library lwjgllib-arm32 for arm32 linux raspiOS*/
+
+ implementation "org.lwjgl:lwjgl:3.2.3:natives-linux-arm32"
+
+ /** if you encounter any problem w/ extraction of .so object files or native libraries of other lwjgl component please add what's missing from lwjgl repositories
+ * implementation "org.lwjgl:lwjgl-glfw:3.2.3:natives-linux-arm32"
+ * implementation "org.lwjgl:lwjgl-opengl:3.2.3:natives-linux-arm32"
+ * implementation "org.lwjgl:lwjgl-openal:3.2.3:natives-linux-arm32"
+ * implementation "org.lwjgl:lwjgl-jemalloc:3.2.3:natives-linux-arm32"
+ */
+
+ /**if you will use GPIO Joystick module to control anything */
+
+ implementation 'com.github.Scrappers-glitch:JoystickModule:1.0.9R'
+
+ /**or if you will use Pi4J gradle implemented from wPi native library
+ *
+ * implementation "com.pi4j:pi4j-core:1.2"
+ * implementation "com.pi4j:pi4j-gpio-extension:1.2"
+ * implementation "com.pi4j:pi4j-device:1.2"
+ *
+ * */
+}
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100755
index 0000000..94336fc
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100755
index 0000000..290541c
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..cccdd3d
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100755
index 0000000..f955316
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/libbulletjme.so b/libbulletjme.so
new file mode 100755
index 0000000..a31b2af
Binary files /dev/null and b/libbulletjme.so differ
diff --git a/local.properties b/local.properties
new file mode 100644
index 0000000..e306021
--- /dev/null
+++ b/local.properties
@@ -0,0 +1,8 @@
+## This file must *NOT* be checked into Version Control Systems,
+# as it contains information specific to your local configuration.
+#
+# Location of the SDK. This is only used by Gradle.
+# For customization when using a Version Control System, please read the
+# header note.
+#Fri Jan 29 18:22:09 CST 2021
+sdk.dir=/home/twisted/Android/Sdk
diff --git a/settings.gradle b/settings.gradle
new file mode 100755
index 0000000..cbfd5bc
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,2 @@
+rootProject.name = 'JmeCarPhysicsTestRPI'
+
diff --git a/src/main/java/GPIOJmeCarTest.java b/src/main/java/GPIOJmeCarTest.java
new file mode 100755
index 0000000..0502e34
--- /dev/null
+++ b/src/main/java/GPIOJmeCarTest.java
@@ -0,0 +1,316 @@
+import com.jme3.app.SimpleApplication;
+import com.jme3.asset.AssetManager;
+import com.jme3.bullet.BulletAppState;
+import com.jme3.bullet.PhysicsSpace;
+import com.jme3.bullet.collision.shapes.BoxCollisionShape;
+import com.jme3.bullet.collision.shapes.CompoundCollisionShape;
+import com.jme3.bullet.collision.shapes.SphereCollisionShape;
+import com.jme3.bullet.control.RigidBodyControl;
+import com.jme3.bullet.control.VehicleControl;
+import com.jme3.bullet.util.CollisionShapeFactory;
+import com.jme3.input.ChaseCamera;
+import com.jme3.light.AmbientLight;
+import com.jme3.light.DirectionalLight;
+import com.jme3.material.Material;
+import com.jme3.material.RenderState;
+import com.jme3.math.ColorRGBA;
+import com.jme3.math.FastMath;
+import com.jme3.math.Vector3f;
+import com.jme3.renderer.queue.RenderQueue;
+import com.jme3.scene.Geometry;
+import com.jme3.scene.Node;
+import com.jme3.scene.Spatial;
+import com.jme3.scene.shape.Cylinder;
+import com.jme3.scene.shape.Sphere;
+import com.jme3.texture.Texture;
+import com.jme3.util.SkyFactory;
+import com.pi4j.io.gpio.PinPullResistance;
+import com.pi4j.io.gpio.RaspiPin;
+import com.pi4j.io.spi.SpiChannel;
+import java.io.IOException;
+/**JmeCarGame using RaspiberryPi GPIO Joystick Module with the help of ADC-MCP3008 & pi4J library
+ * check : JoyStickModuleLibrary:
+ * pi4J GPIO from wPI native ; ${}
+ * */
+public class GPIOJmeCarTest extends SimpleApplication {
+
+ private BulletAppState bulletAppState;
+ private VehicleControl vehicle;
+ private final float brakeForce = 300f;
+ private final Vector3f jumpForce = new Vector3f(0, 2000, 0);
+ private final float accelerationForce = 2000.0f;
+
+
+ public static void main(String[] args) {
+ GPIOJmeCarTest jmeGame=new GPIOJmeCarTest();
+ jmeGame.start();
+ }
+
+ @Override
+ public void simpleInitApp() {
+ bulletAppState = new BulletAppState();
+ stateManager.attach(bulletAppState);
+ bulletAppState.setDebugEnabled(false);
+ addSky();
+ createPhysicsTestWorld(rootNode, getAssetManager(), bulletAppState.getPhysicsSpace());
+ buildPlayer();
+ setupKeys();
+ }
+
+ private void setupKeys() {
+ JoystickModule joystickModule=new JoystickModule(SpiChannel.CS0);
+
+ try {
+ joystickModule.initializeModule(100, RaspiPin.GPIO_21, PinPullResistance.PULL_DOWN);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ joystickModule.registerChannel(JoystickModule.Channels.CH_0);
+ joystickModule.registerChannel(JoystickModule.Channels.CH_1);
+ joystickModule.registerVx(JoystickModule.Channels.CH_1);
+ joystickModule.registerVy(JoystickModule.Channels.CH_0);
+ /*set the listener or implement the interfaces on your class*/
+ joystickModule.setOnForwardListener(valueY -> {
+ valueY+=accelerationForce;
+ vehicle.accelerate(valueY);
+ });
+ joystickModule.setOnBackwardListener(valueY -> {
+ valueY+=accelerationForce;
+ vehicle.accelerate(-valueY);
+ });
+ joystickModule.setSteerRTListener(valueX -> vehicle.steer(-valueX/80f));
+ joystickModule.setSteerLTListener(valueX -> vehicle.steer(valueX/20f));
+ joystickModule.setNeutralizeListener((valueX, valueY) -> {
+ vehicle.clearForces();
+ vehicle.brake(brakeForce);
+ vehicle.accelerate(0);
+ vehicle.steer(0);
+ });
+ joystickModule.setOnClickListener(state -> vehicle.applyImpulse(jumpForce, Vector3f.ZERO));
+ joystickModule.startCollectingChannelsData();
+
+ }
+
+
+
+ private void addSky() {
+ Geometry sky = (Geometry) SkyFactory.createSky(assetManager,assetManager.loadTexture("RocketLeauge/assets/Textures/sky.jpg"),Vector3f.UNIT_XYZ, SkyFactory.EnvMapType.EquirectMap);
+ /*uses low depth level*/
+ sky.getMaterial().getAdditionalRenderState().setDepthFunc(RenderState.TestFunction.LessOrEqual);
+ getRootNode().attachChild(sky);
+ }
+
+ private PhysicsSpace getPhysicsSpace(){
+ return bulletAppState.getPhysicsSpace();
+ }
+
+ /**
+ * creates a simple physics test world with a floor, an obstacle and some test boxes
+ *
+ * @param rootNode where lights and geometries should be added
+ * @param assetManager for loading assets
+ * @param space where collision objects should be added
+ */
+ private void createPhysicsTestWorld(Node rootNode, AssetManager assetManager, PhysicsSpace space) {
+ AmbientLight a=new AmbientLight();
+ a.setColor(new ColorRGBA(0.6f, 0.7f, 0.7f, 0.2f).mult(2));
+
+ Material soccerPlayGround = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+// soccerPlayGround.setTexture("EnvMap",assetManager.loadTexture("RocketLeauge/assets/Textures/sky.jpg"));
+// soccerPlayGround.selectTechnique("PostShadow",getRenderManager());
+ soccerPlayGround.setTexture("ColorMap", assetManager.loadTexture("RocketLeauge/assets/Textures/metalBareTex.jpg"));
+ Spatial floorGeometry = assetManager.loadModel("RocketLeauge/assets/Scenes/SoccerPlayGround.j3o");
+ floorGeometry.setMaterial(soccerPlayGround);
+// DirectionalLight directionalLight=new DirectionalLight(new Vector3f(-3,-floorGeometry.getLocalScale().getY()*4,-3).normalize());
+// directionalLight.setColor(ColorRGBA.White.mult(2f));
+ floorGeometry.addLight(a);
+// rootNode.addLight(directionalLight);
+
+ floorGeometry.setLocalTranslation(0f,-10f,0f);
+ floorGeometry.setLocalScale(15f, floorGeometry.getLocalScale().getY()*4,20f);
+ floorGeometry.addControl(new RigidBodyControl(CollisionShapeFactory.createMeshShape(floorGeometry),0));
+ rootNode.attachChild(floorGeometry);
+ space.add(floorGeometry);
+
+ //ball sphere with mesh collision shape
+ Sphere sphere = new Sphere(15, 15, 5f);
+ Geometry sphereGeometry = new Geometry("Sphere", sphere);
+ sphereGeometry.setMaterial(createMat(ColorRGBA.White,"RocketLeauge/assets/Textures/soccerTex.jpg", sphereGeometry));
+ sphereGeometry.setLocalTranslation(0f, -5f, 0f);
+ sphereGeometry.setShadowMode(RenderQueue.ShadowMode.Cast);
+
+ RigidBodyControl ballControl=new RigidBodyControl(new SphereCollisionShape(5f), 0.5f);
+ ballControl.setFriction(2f);
+ ballControl.setLinearVelocity(new Vector3f(0.2f,0.2f,0.2f));
+ ballControl.setRollingFriction(1f);
+
+
+ sphereGeometry.addControl(ballControl);
+ rootNode.attachChild(sphereGeometry);
+ space.add(sphereGeometry);
+
+// DirectionalLightShadowRenderer dlsr=new DirectionalLightShadowRenderer(assetManager,512,1);
+// dlsr.setLight(directionalLight);
+// dlsr.setShadowIntensity(0.2f);
+// dlsr.setLambda(0.55f);
+// dlsr.setShadowCompareMode(CompareMode.Hardware);
+// dlsr.setShadowZExtend(23f);
+// dlsr.setShadowZFadeLength(8f);
+// floorGeometry.setShadowMode(RenderQueue.ShadowMode.Receive);
+// viewPort.addProcessor(dlsr);
+
+
+ }
+
+ private void buildPlayer() {
+ cam.setFrustumFar(2000f);
+ Material mat = new Material(getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
+ mat.getAdditionalRenderState().setWireframe(false);
+ mat.setColor("Color", ColorRGBA.Black);
+
+ //create a compound shape and attach the BoxCollisionShape for the car body at 0,1,0
+ //this shifts the effective center of mass of the BoxCollisionShape to 0,-1,0
+ CompoundCollisionShape compoundShape = new CompoundCollisionShape();
+ BoxCollisionShape box = new BoxCollisionShape(new Vector3f(4.2f, 0.8f, 4.5f));
+
+ compoundShape.addChildShape(box, new Vector3f(0, 2f, 0));
+
+ Spatial chassis = assetManager.loadModel("RocketLeauge/assets/Models/ladaCar.j3o");
+ chassis.setShadowMode(RenderQueue.ShadowMode.Cast);
+ chassis.setLocalScale(2.2f,2.2f,2.2f);
+ chassis.setLocalTranslation(new Vector3f(0, 1.2f, 0));
+ //colors
+ ((Node) chassis).getChild("glass").setMaterial(createMat(ColorRGBA.Black,"",null));
+ ((Node) chassis).getChild("chassis").setMaterial(createMat(ColorRGBA.randomColor(), "", chassis));
+ ((Node) chassis).getChild("addOns").setMaterial(createMat(null, "RocketLeauge/assets/Textures/bronzeCopperTex.jpg",null));
+ ((Node) chassis).getChild("nitro").setMaterial(createMat(new ColorRGBA(0f,0f,5f,1f), "RocketLeauge/assets/Textures/metalBareTex.jpg",null));
+
+ ((Node) chassis).getChild("frontLight").setMaterial(createMat(ColorRGBA.White,"",null));
+ ((Node) chassis).getChild("backLights").setMaterial(createMat(ColorRGBA.Red,"",null));
+ ((Node) chassis).getChild("uTurns").setMaterial(createMat(ColorRGBA.Yellow,"", chassis));
+ ((Node) chassis).getChild("mirrors").setMaterial(createMat(ColorRGBA.White,"",null));
+
+
+ //create vehicle node
+ Node vehicleNode=new Node("vehicleNode");
+ vehicleNode.attachChild(chassis);
+ vehicleNode.setShadowMode(RenderQueue.ShadowMode.Cast);
+// chassis.setMaterial(mat);
+ vehicle = new VehicleControl(compoundShape, 600f);
+ vehicleNode.addControl(vehicle);
+ vehicle.setPhysicsLocation(new Vector3f(20f,5f,10f));
+ //add a chaseCam tomove the cam with the object
+
+ ChaseCamera chaseCam = new ChaseCamera(cam, vehicleNode);
+ chaseCam.setDefaultDistance(-18f);
+ chaseCam.registerWithInput(inputManager);
+ chaseCam.setDragToRotate(true);
+ //setting suspension values for wheels, this can be a bit tricky
+ //see also https://docs.google.com/Doc?docid=0AXVUZ5xw6XpKZGNuZG56a3FfMzU0Z2NyZnF4Zmo&hl=en
+ float stiffness =30.0f;//200=f1 car
+ float compValue = 0.5f; //(should be lower than damp)
+ float dampValue = 3f;
+ //compression force of spring(Shock Producer)
+ vehicle.setSuspensionCompression(compValue * 2.0f * FastMath.sqrt(stiffness));
+ //stretch force of spring(Shock Absorber)
+ vehicle.setSuspensionDamping(dampValue * 2.0f * FastMath.sqrt(stiffness));
+ vehicle.setSuspensionStiffness(stiffness);
+ vehicle.setMaxSuspensionForce(FastMath.pow(2, 20));
+
+ //Create four wheels and add them at their locations
+ Vector3f wheelDirection = new Vector3f(0,-1F, 0); // was 0, -1, 0
+ Vector3f wheelAxle = new Vector3f(-6, 0, 0); // was -1, 0, 0
+ float radius = 0.5f;
+ float restLength = 0.1f;
+ float yOff = radius;
+ float xOff = 4*radius;
+ float zOff = 6.5f*radius;
+
+ Cylinder wheelMesh = new Cylinder(16, 16, radius, radius * 0.5f, true);
+
+ Node node1 = new Node("wheel 1 node");
+ Geometry wheels1 = new Geometry("wheel 1", wheelMesh);
+ node1.attachChild(wheels1);
+ wheels1.rotate(0, FastMath.HALF_PI, 0);
+ wheels1.setMaterial(mat);
+ vehicle.addWheel(node1, new Vector3f(-xOff, yOff, zOff),
+ wheelDirection, wheelAxle, restLength, radius, true);
+
+ Node node2 = new Node("wheel 2 node");
+ Geometry wheels2 = new Geometry("wheel 2", wheelMesh);
+ node2.attachChild(wheels2);
+ wheels2.rotate(0, FastMath.HALF_PI, 0);
+ wheels2.setMaterial(mat);
+ vehicle.addWheel(node2, new Vector3f(xOff, yOff, zOff),
+ wheelDirection, wheelAxle, restLength, radius, true);
+ Node node3;
+ Node node4;
+ node3 = new Node("wheel 3 node");
+ Geometry wheels3 = new Geometry("wheel 3", wheelMesh);
+ node3.attachChild(wheels3);
+ wheels3.rotate(0, FastMath.HALF_PI, 0);
+ wheels3.setMaterial(mat);
+ vehicle.addWheel(node3, new Vector3f(-xOff, yOff, -zOff),
+ wheelDirection, wheelAxle, restLength, radius, false);
+
+ node4 = new Node("wheel 4 node");
+ Geometry wheels4 = new Geometry("wheel 4", wheelMesh);
+ node4.attachChild(wheels4);
+ wheels4.rotate(0, FastMath.HALF_PI, 0);
+ wheels4.setMaterial(mat);
+ vehicle.addWheel(node4, new Vector3f(xOff, yOff, -zOff),
+ wheelDirection, wheelAxle, restLength, radius, false);
+
+ vehicleNode.attachChild(node1);
+ vehicleNode.attachChild(node2);
+ vehicleNode.attachChild(node3);
+ vehicleNode.attachChild(node4);
+ rootNode.attachChild(vehicleNode);
+
+ setWheelFrictionSlip(20f);
+
+ getPhysicsSpace().add(vehicle);
+ DirectionalLight directionalLight=new DirectionalLight(new Vector3f(2,2,2).mult(50).normalize());
+ directionalLight.setColor(ColorRGBA.White);
+ vehicleNode.addLight(directionalLight);
+
+ }
+
+ private void setWheelFrictionSlip(float frictionSlip) {
+ for(int nOfWheel=0;nOfWheel1){
+ Texture texture=assetManager.loadTexture(Tex);
+ material.setTexture("ColorMap",texture);
+ }
+ material.setReceivesShadows(true);
+ return material;
+ }
+
+ @Override
+ public void simpleUpdate(float tpf) {
+
+ }
+
+}
diff --git a/src/main/java/JmeCarPhysics.java b/src/main/java/JmeCarPhysics.java
new file mode 100755
index 0000000..237ea33
--- /dev/null
+++ b/src/main/java/JmeCarPhysics.java
@@ -0,0 +1,242 @@
+import com.jme3.app.SimpleApplication;
+import com.jme3.asset.AssetManager;
+import com.jme3.bullet.BulletAppState;
+import com.jme3.bullet.PhysicsSpace;
+import com.jme3.bullet.collision.shapes.BoxCollisionShape;
+import com.jme3.bullet.collision.shapes.CompoundCollisionShape;
+import com.jme3.bullet.collision.shapes.MeshCollisionShape;
+import com.jme3.bullet.control.RigidBodyControl;
+import com.jme3.bullet.control.VehicleControl;
+import com.jme3.input.ChaseCamera;
+import com.jme3.input.KeyInput;
+import com.jme3.input.controls.ActionListener;
+import com.jme3.input.controls.KeyTrigger;
+import com.jme3.light.AmbientLight;
+import com.jme3.material.Material;
+import com.jme3.math.ColorRGBA;
+import com.jme3.math.FastMath;
+import com.jme3.math.Matrix3f;
+import com.jme3.math.Vector3f;
+import com.jme3.scene.Geometry;
+import com.jme3.scene.Node;
+import com.jme3.scene.shape.Box;
+import com.jme3.scene.shape.Cylinder;
+import com.jme3.scene.shape.Sphere;
+/**Jme bare bone car Physics test*/
+public class JmeCarPhysics extends SimpleApplication implements ActionListener {
+
+ private BulletAppState bulletAppState;
+ private VehicleControl vehicle;
+ private final float accelerationForce = 1000.0f;
+ private final float brakeForce = 100.0f;
+ private float steeringValue = 0;
+ private float accelerationValue = 0;
+ private Vector3f jumpForce = new Vector3f(0, 3000, 0);
+
+ public static void main(String[] args) {
+ JmeCarPhysics app = new JmeCarPhysics();
+ app.start();
+ }
+
+ @Override
+ public void simpleInitApp() {
+ bulletAppState = new BulletAppState();
+ stateManager.attach(bulletAppState);
+ createPhysicsTestWorld(rootNode, assetManager, bulletAppState.getPhysicsSpace());
+ setupKeys();
+ buildPlayer();
+ }
+
+ private PhysicsSpace getPhysicsSpace(){
+ return bulletAppState.getPhysicsSpace();
+ }
+
+ private void setupKeys() {
+ inputManager.addMapping("Lefts", new KeyTrigger(KeyInput.KEY_LEFT));
+ inputManager.addMapping("Rights", new KeyTrigger(KeyInput.KEY_RIGHT));
+ inputManager.addMapping("Ups", new KeyTrigger(KeyInput.KEY_UP));
+ inputManager.addMapping("Downs", new KeyTrigger(KeyInput.KEY_DOWN));
+ inputManager.addMapping("Space", new KeyTrigger(KeyInput.KEY_SPACE));
+ inputManager.addMapping("Reset", new KeyTrigger(KeyInput.KEY_RETURN));
+ inputManager.addListener(this, "Lefts");
+ inputManager.addListener(this, "Rights");
+ inputManager.addListener(this, "Ups");
+ inputManager.addListener(this, "Downs");
+ inputManager.addListener(this, "Space");
+ inputManager.addListener(this, "Reset");
+ }
+
+ private void buildPlayer() {
+ Material mat = new Material(getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
+ mat.getAdditionalRenderState().setWireframe(true);
+ mat.setColor("Color", ColorRGBA.Red);
+
+ //create a compound shape and attach the BoxCollisionShape for the car body at 0,1,0
+ //this shifts the effective center of mass of the BoxCollisionShape to 0,-1,0
+ CompoundCollisionShape compoundShape = new CompoundCollisionShape();
+ BoxCollisionShape box = new BoxCollisionShape(new Vector3f(1.2f, 0.5f, 2.4f));
+ compoundShape.addChildShape(box, new Vector3f(0, 1, 0));
+
+ //create vehicle node
+ Node vehicleNode=new Node("vehicleNode");
+ vehicle = new VehicleControl(compoundShape, 400);
+ vehicleNode.addControl(vehicle);
+
+ //setting suspension values for wheels, this can be a bit tricky
+ //see also https://docs.google.com/Doc?docid=0AXVUZ5xw6XpKZGNuZG56a3FfMzU0Z2NyZnF4Zmo&hl=en
+ float stiffness = 60.0f;//200=f1 car
+ float compValue = .3f; //(should be lower than damp)
+ float dampValue = .4f;
+ vehicle.setSuspensionCompression(compValue * 2.0f * FastMath.sqrt(stiffness));
+ vehicle.setSuspensionDamping(dampValue * 2.0f * FastMath.sqrt(stiffness));
+ vehicle.setSuspensionStiffness(stiffness);
+ vehicle.setMaxSuspensionForce(10000.0f);
+
+ //Create four wheels and add them at their locations
+ Vector3f wheelDirection = new Vector3f(0, -1, 0); // was 0, -1, 0
+ Vector3f wheelAxle = new Vector3f(-1, 0, 0); // was -1, 0, 0
+ float radius = 0.5f;
+ float restLength = 0.3f;
+ float yOff = 0.5f;
+ float xOff = 1f;
+ float zOff = 2f;
+
+ Cylinder wheelMesh = new Cylinder(16, 16, radius, radius * 0.6f, true);
+
+ Node node1 = new Node("wheel 1 node");
+ Geometry wheels1 = new Geometry("wheel 1", wheelMesh);
+ node1.attachChild(wheels1);
+ wheels1.rotate(0, FastMath.HALF_PI, 0);
+ wheels1.setMaterial(mat);
+ vehicle.addWheel(node1, new Vector3f(-xOff, yOff, zOff),
+ wheelDirection, wheelAxle, restLength, radius, true);
+
+ Node node2 = new Node("wheel 2 node");
+ Geometry wheels2 = new Geometry("wheel 2", wheelMesh);
+ node2.attachChild(wheels2);
+ wheels2.rotate(0, FastMath.HALF_PI, 0);
+ wheels2.setMaterial(mat);
+ vehicle.addWheel(node2, new Vector3f(xOff, yOff, zOff),
+ wheelDirection, wheelAxle, restLength, radius, true);
+
+ Node node3 = new Node("wheel 3 node");
+ Geometry wheels3 = new Geometry("wheel 3", wheelMesh);
+ node3.attachChild(wheels3);
+ wheels3.rotate(0, FastMath.HALF_PI, 0);
+ wheels3.setMaterial(mat);
+ vehicle.addWheel(node3, new Vector3f(-xOff, yOff, -zOff),
+ wheelDirection, wheelAxle, restLength, radius, false);
+
+ Node node4 = new Node("wheel 4 node");
+ Geometry wheels4 = new Geometry("wheel 4", wheelMesh);
+ node4.attachChild(wheels4);
+ wheels4.rotate(0, FastMath.HALF_PI, 0);
+ wheels4.setMaterial(mat);
+ vehicle.addWheel(node4, new Vector3f(xOff, yOff, -zOff),
+ wheelDirection, wheelAxle, restLength, radius, false);
+
+ vehicleNode.attachChild(node1);
+ vehicleNode.attachChild(node2);
+ vehicleNode.attachChild(node3);
+ vehicleNode.attachChild(node4);
+ rootNode.attachChild(vehicleNode);
+
+ getPhysicsSpace().add(vehicle);
+
+ ChaseCamera chaseCamera=new ChaseCamera(cam,vehicleNode);
+ chaseCamera.registerWithInput(inputManager);
+ chaseCamera.setDefaultDistance(-20);
+ chaseCamera.setSmoothMotion(true);
+ }
+
+ @Override
+ public void simpleUpdate(float tpf) {
+ cam.lookAt(vehicle.getPhysicsLocation(), Vector3f.UNIT_Y);
+ }
+
+ @Override
+ public void onAction(String binding, boolean value, float tpf) {
+ if (binding.equals("Lefts")) {
+ if (value) {
+ steeringValue += .5f;
+ } else {
+ steeringValue += -.5f;
+ }
+ vehicle.steer(steeringValue);
+ } else if (binding.equals("Rights")) {
+ if (value) {
+ steeringValue += -.5f;
+ } else {
+ steeringValue += .5f;
+ }
+ vehicle.steer(steeringValue);
+ } else if (binding.equals("Ups")) {
+ if (value) {
+ accelerationValue += accelerationForce;
+ } else {
+ accelerationValue -= accelerationForce;
+ }
+ vehicle.accelerate(accelerationValue);
+ } else if (binding.equals("Downs")) {
+ if (value) {
+ vehicle.brake(brakeForce);
+ } else {
+ vehicle.brake(0f);
+ }
+ } else if (binding.equals("Space")) {
+ if (value) {
+ vehicle.applyImpulse(jumpForce, Vector3f.ZERO);
+ }
+ } else if (binding.equals("Reset")) {
+ if (value) {
+ System.out.println("Reset");
+ vehicle.setPhysicsLocation(Vector3f.ZERO);
+ vehicle.setPhysicsRotation(new Matrix3f());
+ vehicle.setLinearVelocity(Vector3f.ZERO);
+ vehicle.setAngularVelocity(Vector3f.ZERO);
+ vehicle.resetSuspension();
+ } else {
+ }
+ }
+ }
+ public static void createPhysicsTestWorld(Node rootNode, AssetManager assetManager, PhysicsSpace space) {
+ AmbientLight light = new AmbientLight();
+ light.setColor(ColorRGBA.LightGray);
+ rootNode.addLight(light);
+
+ Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+
+ Box floorBox = new Box(140, 0.25f, 140);
+ Geometry floorGeometry = new Geometry("Floor", floorBox);
+ floorGeometry.setMaterial(material);
+ floorGeometry.setLocalTranslation(0, -5, 0);
+// Plane plane = new Plane();
+// plane.setOriginNormal(new Vector3f(0, 0.25f, 0), Vector3f.UNIT_Y);
+// floorGeometry.addControl(new RigidBodyControl(new PlaneCollisionShape(plane), 0));
+ floorGeometry.addControl(new RigidBodyControl(0));
+ rootNode.attachChild(floorGeometry);
+ space.add(floorGeometry);
+
+ //movable boxes
+ for (int i = 0; i < 12; i++) {
+ Box box = new Box(0.25f, 0.25f, 0.25f);
+ Geometry boxGeometry = new Geometry("Box", box);
+ boxGeometry.setMaterial(material);
+ boxGeometry.setLocalTranslation(i, 5, -3);
+ //RigidBodyControl automatically uses box collision shapes when attached to single geometry with box mesh
+ boxGeometry.addControl(new RigidBodyControl(2));
+ rootNode.attachChild(boxGeometry);
+ space.add(boxGeometry);
+ }
+
+ //immovable sphere with mesh collision shape
+ Sphere sphere = new Sphere(8, 8, 1);
+ Geometry sphereGeometry = new Geometry("Sphere", sphere);
+ sphereGeometry.setMaterial(material);
+ sphereGeometry.setLocalTranslation(4, -4, 2);
+ sphereGeometry.addControl(new RigidBodyControl(new MeshCollisionShape(sphere), 0));
+ rootNode.attachChild(sphereGeometry);
+ space.add(sphereGeometry);
+
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/JmeCarSoccerGame.java b/src/main/java/JmeCarSoccerGame.java
new file mode 100755
index 0000000..6d56f64
--- /dev/null
+++ b/src/main/java/JmeCarSoccerGame.java
@@ -0,0 +1,356 @@
+import com.jme3.app.SimpleApplication;
+import com.jme3.asset.AssetManager;
+import com.jme3.bullet.BulletAppState;
+import com.jme3.bullet.PhysicsSpace;
+import com.jme3.bullet.collision.shapes.BoxCollisionShape;
+import com.jme3.bullet.collision.shapes.CompoundCollisionShape;
+import com.jme3.bullet.collision.shapes.SphereCollisionShape;
+import com.jme3.bullet.control.RigidBodyControl;
+import com.jme3.bullet.control.VehicleControl;
+import com.jme3.bullet.util.CollisionShapeFactory;
+import com.jme3.input.ChaseCamera;
+import com.jme3.input.KeyInput;
+import com.jme3.input.controls.ActionListener;
+import com.jme3.input.controls.KeyTrigger;
+import com.jme3.light.AmbientLight;
+import com.jme3.light.DirectionalLight;
+import com.jme3.material.Material;
+import com.jme3.material.RenderState;
+import com.jme3.math.ColorRGBA;
+import com.jme3.math.FastMath;
+import com.jme3.math.Matrix3f;
+import com.jme3.math.Vector3f;
+import com.jme3.renderer.queue.RenderQueue;
+import com.jme3.scene.Geometry;
+import com.jme3.scene.Node;
+import com.jme3.scene.Spatial;
+import com.jme3.scene.shape.Cylinder;
+import com.jme3.scene.shape.Sphere;
+import com.jme3.texture.Texture;
+import com.jme3.util.SkyFactory;
+
+/**
+ * JmeCarPhysics fullTest using jme3core , lwjgl-input , minie for RPI devices with geometeries, materials,shaders,lights,physics,skybox,car physics & rigidphysics.
+ */
+public class JmeCarSoccerGame extends SimpleApplication implements ActionListener {
+
+ private BulletAppState bulletAppState;
+ private VehicleControl vehicle;
+ private final float brakeForce = 300f;
+ private final Vector3f jumpForce = new Vector3f(0, 2000, 0);
+ private final Vector3f rushForce = Vector3f.UNIT_XYZ;
+ private Spatial chassis;
+ private final float accelerationForce = 2000.0f;
+ private float steeringValue = 0;
+ private float accelerationValue = 0;
+
+ public static void main(String[] args) {
+ JmeCarSoccerGame jmeGame=new JmeCarSoccerGame();
+ jmeGame.start();
+ }
+
+ @Override
+ public void simpleInitApp() {
+ bulletAppState = new BulletAppState();
+ stateManager.attach(bulletAppState);
+ bulletAppState.setDebugEnabled(false);
+ addSky();
+ createPhysicsTestWorld(rootNode, getAssetManager(), bulletAppState.getPhysicsSpace());
+ buildPlayer();
+ setupKeys();
+ }
+
+ private void setupKeys() {
+ inputManager.addMapping("Lefts", new KeyTrigger(KeyInput.KEY_LEFT));
+ inputManager.addMapping("Rights", new KeyTrigger(KeyInput.KEY_RIGHT));
+ inputManager.addMapping("Ups", new KeyTrigger(KeyInput.KEY_UP));
+ inputManager.addMapping("Downs", new KeyTrigger(KeyInput.KEY_DOWN));
+ inputManager.addMapping("Space", new KeyTrigger(KeyInput.KEY_SPACE));
+ inputManager.addMapping("Reset", new KeyTrigger(KeyInput.KEY_RETURN));
+ inputManager.addListener(this, "Lefts");
+ inputManager.addListener(this, "Rights");
+ inputManager.addListener(this, "Ups");
+ inputManager.addListener(this, "Downs");
+ inputManager.addListener(this, "Space");
+ inputManager.addListener(this, "Reset");
+ }
+ @Override
+ public void onAction(String binding, boolean value, float tpf) {
+ switch (binding) {
+ case "Lefts":
+ if (value) {
+ steeringValue += .5f;
+ } else {
+ steeringValue += -.5f;
+ }
+ vehicle.steer(steeringValue);
+ break;
+ case "Rights":
+ if (value) {
+ steeringValue += -.5f;
+ } else {
+ steeringValue += .5f;
+ }
+ vehicle.steer(steeringValue);
+ break;
+ case "Ups":
+ if (value) {
+ accelerationValue += accelerationForce;
+ } else {
+ accelerationValue -= accelerationForce;
+ }
+ vehicle.accelerate(accelerationValue);
+ break;
+ case "Downs":
+ if (value) {
+ vehicle.brake(brakeForce);
+ } else {
+ vehicle.brake(0f);
+ }
+ break;
+ case "Space":
+ if (value) {
+ vehicle.applyImpulse(jumpForce, Vector3f.ZERO);
+ }
+ break;
+ case "Reset":
+ if (value) {
+ System.out.println("Reset");
+ vehicle.setPhysicsLocation(Vector3f.ZERO);
+ vehicle.setPhysicsRotation(new Matrix3f());
+ vehicle.setLinearVelocity(Vector3f.ZERO);
+ vehicle.setAngularVelocity(Vector3f.ZERO);
+ vehicle.resetSuspension();
+ }
+ break;
+ }
+ }
+
+
+ private void addSky() {
+ Geometry sky = (Geometry) SkyFactory.createSky(assetManager,assetManager.loadTexture("RocketLeauge/assets/Textures/sky.jpg"),Vector3f.UNIT_XYZ, SkyFactory.EnvMapType.EquirectMap);
+ sky.getMaterial().getAdditionalRenderState().setDepthFunc(RenderState.TestFunction.LessOrEqual);
+ getRootNode().attachChild(sky);
+ }
+
+ private PhysicsSpace getPhysicsSpace(){
+ return bulletAppState.getPhysicsSpace();
+ }
+
+ /**
+ * creates a simple physics test world with a floor, an obstacle and some test boxes
+ *
+ * @param rootNode where lights and geometries should be added
+ * @param assetManager for loading assets
+ * @param space where collision objects should be added
+ */
+ private void createPhysicsTestWorld(Node rootNode, AssetManager assetManager, PhysicsSpace space) {
+ AmbientLight a=new AmbientLight();
+ a.setColor(new ColorRGBA(0.6f, 0.7f, 0.7f, 0.2f).mult(2));
+
+ Material soccerPlayGround = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+
+// soccerPlayGround.setTexture("EnvMap",assetManager.loadTexture("RocketLeauge/assets/Textures/sky.jpg"));
+// soccerPlayGround.selectTechnique("PostShadow",getRenderManager());
+
+ soccerPlayGround.setTexture("ColorMap", assetManager.loadTexture("RocketLeauge/assets/Textures/metalBareTex.jpg"));
+
+ floorGeometry=assetManager.loadModel("RocketLeauge/assets/Scenes/SoccerPlayGround.j3o");
+ floorGeometry.setMaterial(soccerPlayGround);
+// DirectionalLight directionalLight=new DirectionalLight(new Vector3f(-3,-floorGeometry.getLocalScale().getY()*4,-3).normalize());
+// directionalLight.setColor(ColorRGBA.White.mult(2f));
+ floorGeometry.addLight(a);
+// rootNode.addLight(directionalLight);
+
+ floorGeometry.setLocalTranslation(0f,-10f,0f);
+ floorGeometry.setLocalScale(15f,floorGeometry.getLocalScale().getY()*4,20f);
+ floorGeometry.addControl(new RigidBodyControl(CollisionShapeFactory.createMeshShape(floorGeometry),0));
+ rootNode.attachChild(floorGeometry);
+ space.add(floorGeometry);
+
+ //ball sphere with mesh collision shape
+ Sphere sphere = new Sphere(15, 15, 5f);
+ sphereGeometry = new Geometry("Sphere", sphere);
+ sphereGeometry.setMaterial(createMat(ColorRGBA.White,"RocketLeauge/assets/Textures/soccerTex.jpg",sphereGeometry));
+ sphereGeometry.setLocalTranslation(0f, -5f, 0f);
+ sphereGeometry.setShadowMode(RenderQueue.ShadowMode.Cast);
+
+ RigidBodyControl ballControl=new RigidBodyControl(new SphereCollisionShape(5f), 0.5f);
+ ballControl.setFriction(2f);
+ ballControl.setLinearVelocity(new Vector3f(0.2f,0.2f,0.2f));
+ ballControl.setRollingFriction(1f);
+
+
+ sphereGeometry.addControl(ballControl);
+ rootNode.attachChild(sphereGeometry);
+ space.add(sphereGeometry);
+
+// DirectionalLightShadowRenderer dlsr=new DirectionalLightShadowRenderer(assetManager,512,1);
+// dlsr.setLight(directionalLight);
+// dlsr.setShadowIntensity(0.2f);
+// dlsr.setLambda(0.55f);
+// dlsr.setShadowCompareMode(CompareMode.Hardware);
+// dlsr.setShadowZExtend(23f);
+// dlsr.setShadowZFadeLength(8f);
+// floorGeometry.setShadowMode(RenderQueue.ShadowMode.Receive);
+// viewPort.addProcessor(dlsr);
+
+
+ }
+ Spatial floorGeometry;
+ Geometry sphereGeometry;
+
+
+ ChaseCamera chaseCam;
+ private void buildPlayer() {
+ cam.setFrustumFar(2000f);
+ Material mat = new Material(getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
+ mat.getAdditionalRenderState().setWireframe(false);
+ mat.setColor("Color", ColorRGBA.Black);
+
+ //create a compound shape and attach the BoxCollisionShape for the car body at 0,1,0
+ //this shifts the effective center of mass of the BoxCollisionShape to 0,-1,0
+ CompoundCollisionShape compoundShape = new CompoundCollisionShape();
+ BoxCollisionShape box = new BoxCollisionShape(new Vector3f(4.2f, 0.8f, 4.5f));
+
+ compoundShape.addChildShape(box, new Vector3f(0, 2f, 0));
+
+ chassis =assetManager.loadModel("RocketLeauge/assets/Models/ladaCar.j3o");
+ chassis.setShadowMode(RenderQueue.ShadowMode.Cast);
+ chassis.setLocalScale(2.2f,2.2f,2.2f);
+ chassis.setLocalTranslation(new Vector3f(0, 1.2f, 0));
+ //colors
+ ((Node) chassis).getChild("glass").setMaterial(createMat(ColorRGBA.Black,"",null));
+ ((Node) chassis).getChild("chassis").setMaterial(createMat(ColorRGBA.randomColor(), "",chassis));
+ ((Node) chassis).getChild("addOns").setMaterial(createMat(null, "RocketLeauge/assets/Textures/bronzeCopperTex.jpg",null));
+ ((Node) chassis).getChild("nitro").setMaterial(createMat(new ColorRGBA(0f,0f,5f,1f), "RocketLeauge/assets/Textures/metalBareTex.jpg",null));
+
+ ((Node) chassis).getChild("frontLight").setMaterial(createMat(ColorRGBA.White,"",null));
+ ((Node) chassis).getChild("backLights").setMaterial(createMat(ColorRGBA.Red,"",null));
+ ((Node) chassis).getChild("uTurns").setMaterial(createMat(ColorRGBA.Yellow,"",chassis));
+ ((Node) chassis).getChild("mirrors").setMaterial(createMat(ColorRGBA.White,"",null));
+
+
+ //create vehicle node
+ Node vehicleNode=new Node("vehicleNode");
+ vehicleNode.attachChild(chassis);
+ vehicleNode.setShadowMode(RenderQueue.ShadowMode.Cast);
+// chassis.setMaterial(mat);
+ vehicle = new VehicleControl(compoundShape, 600f);
+ vehicleNode.addControl(vehicle);
+ vehicle.setPhysicsLocation(new Vector3f(20f,5f,10f));
+ //add a chaseCam tomove the cam with the object
+
+ chaseCam=new ChaseCamera(cam, vehicleNode);
+ chaseCam.setDefaultDistance(-18f);
+ chaseCam.registerWithInput(inputManager);
+ chaseCam.setDragToRotate(true);
+ //setting suspension values for wheels, this can be a bit tricky
+ //see also https://docs.google.com/Doc?docid=0AXVUZ5xw6XpKZGNuZG56a3FfMzU0Z2NyZnF4Zmo&hl=en
+ float stiffness =30.0f;//200=f1 car
+ float compValue = 0.5f; //(should be lower than damp)
+ float dampValue = 3f;
+ //compression force of spring(Shock Producer)
+ vehicle.setSuspensionCompression(compValue * 2.0f * FastMath.sqrt(stiffness));
+ //stretch force of spring(Shock Absorber)
+ vehicle.setSuspensionDamping(dampValue * 2.0f * FastMath.sqrt(stiffness));
+ vehicle.setSuspensionStiffness(stiffness);
+ vehicle.setMaxSuspensionForce(FastMath.pow(2, 20));
+
+ //Create four wheels and add them at their locations
+ Vector3f wheelDirection = new Vector3f(0,-1F, 0); // was 0, -1, 0
+ Vector3f wheelAxle = new Vector3f(-6, 0, 0); // was -1, 0, 0
+ float radius = 0.5f;
+ float restLength = 0.1f;
+ float yOff = radius;
+ float xOff = 4*radius;
+ float zOff = 6.5f*radius;
+
+ Cylinder wheelMesh = new Cylinder(16, 16, radius, radius * 0.5f, true);
+
+ Node node1 = new Node("wheel 1 node");
+ Geometry wheels1 = new Geometry("wheel 1", wheelMesh);
+ node1.attachChild(wheels1);
+ wheels1.rotate(0, FastMath.HALF_PI, 0);
+ wheels1.setMaterial(mat);
+ vehicle.addWheel(node1, new Vector3f(-xOff, yOff, zOff),
+ wheelDirection, wheelAxle, restLength, radius, true);
+
+ Node node2 = new Node("wheel 2 node");
+ Geometry wheels2 = new Geometry("wheel 2", wheelMesh);
+ node2.attachChild(wheels2);
+ wheels2.rotate(0, FastMath.HALF_PI, 0);
+ wheels2.setMaterial(mat);
+ vehicle.addWheel(node2, new Vector3f(xOff, yOff, zOff),
+ wheelDirection, wheelAxle, restLength, radius, true);
+ Node node3;
+ Node node4;
+ node3 = new Node("wheel 3 node");
+ Geometry wheels3 = new Geometry("wheel 3", wheelMesh);
+ node3.attachChild(wheels3);
+ wheels3.rotate(0, FastMath.HALF_PI, 0);
+ wheels3.setMaterial(mat);
+ vehicle.addWheel(node3, new Vector3f(-xOff, yOff, -zOff),
+ wheelDirection, wheelAxle, restLength, radius, false);
+
+ node4 = new Node("wheel 4 node");
+ Geometry wheels4 = new Geometry("wheel 4", wheelMesh);
+ node4.attachChild(wheels4);
+ wheels4.rotate(0, FastMath.HALF_PI, 0);
+ wheels4.setMaterial(mat);
+ vehicle.addWheel(node4, new Vector3f(xOff, yOff, -zOff),
+ wheelDirection, wheelAxle, restLength, radius, false);
+
+ vehicleNode.attachChild(node1);
+ vehicleNode.attachChild(node2);
+ vehicleNode.attachChild(node3);
+ vehicleNode.attachChild(node4);
+ rootNode.attachChild(vehicleNode);
+
+ setWheelFrictionSlip(20f);
+
+ getPhysicsSpace().add(vehicle);
+ DirectionalLight directionalLight=new DirectionalLight(new Vector3f(2,2,2).mult(50).normalize());
+ directionalLight.setColor(ColorRGBA.White);
+ vehicleNode.addLight(directionalLight);
+
+ }
+
+ private void setWheelFrictionSlip(float frictionSlip) {
+ for(int nOfWheel=0;nOfWheel1){
+ Texture texture=assetManager.loadTexture(Tex);
+ material.setTexture("ColorMap",texture);
+ }
+ material.setReceivesShadows(true);
+ return material;
+ }
+
+ @Override
+ public void simpleUpdate(float tpf) {
+
+ }
+
+}
diff --git a/src/main/java/TestRigidPhysics.java b/src/main/java/TestRigidPhysics.java
new file mode 100755
index 0000000..b80b889
--- /dev/null
+++ b/src/main/java/TestRigidPhysics.java
@@ -0,0 +1,86 @@
+import com.jme3.app.SimpleApplication;
+import com.jme3.asset.AssetManager;
+import com.jme3.bullet.BulletAppState;
+import com.jme3.bullet.PhysicsSpace;
+import com.jme3.bullet.collision.shapes.*;
+import com.jme3.bullet.control.RigidBodyControl;
+import com.jme3.math.Plane;
+import com.jme3.math.Vector3f;
+import com.jme3.scene.Node;
+import com.jme3.scene.shape.Sphere;
+
+/** Test Jme Physics */
+public class TestRigidPhysics extends SimpleApplication {
+ private BulletAppState bulletAppState;
+ public static void main(String[] args) {
+ TestRigidPhysics jmETest=new TestRigidPhysics();
+ jmETest.start();
+ }
+
+ @Override
+ public void simpleInitApp() {
+ bulletAppState = new BulletAppState();
+ stateManager.attach(bulletAppState);
+ bulletAppState.setDebugEnabled(true);
+
+ // Add a physics sphere to the world
+ Node physicsSphere = createPhysicsTestNode(assetManager, new SphereCollisionShape(1), 1);
+ physicsSphere.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(3, 6, 0));
+ rootNode.attachChild(physicsSphere);
+ getPhysicsSpace().add(physicsSphere);
+
+ // Add a physics sphere to the world using the collision shape from sphere one
+ Node physicsSphere2 = createPhysicsTestNode(assetManager, physicsSphere.getControl(RigidBodyControl.class).getCollisionShape(), 1);
+ physicsSphere2.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(4, 8, 0));
+ rootNode.attachChild(physicsSphere2);
+ getPhysicsSpace().add(physicsSphere2);
+
+ // Add a physics box to the world
+ Node physicsBox = createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f(1, 1, 1)), 1);
+ physicsBox.getControl(RigidBodyControl.class).setFriction(0.1f);
+ physicsBox.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(.6f, 4, .5f));
+ rootNode.attachChild(physicsBox);
+ getPhysicsSpace().add(physicsBox);
+
+ // Add a physics cylinder to the world
+ Node physicsCylinder = createPhysicsTestNode(assetManager, new CylinderCollisionShape(new Vector3f(1f, 1f, 1.5f)), 1);
+ physicsCylinder.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(2, 2, 0));
+ rootNode.attachChild(physicsCylinder);
+ getPhysicsSpace().add(physicsCylinder);
+
+ // an obstacle mesh, does not move (mass=0)
+ Node node2 = createPhysicsTestNode(assetManager, new MeshCollisionShape(new Sphere(16, 16, 1.2f)), 0);
+ node2.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(2.5f, -4, 0f));
+ rootNode.attachChild(node2);
+ getPhysicsSpace().add(node2);
+
+ // the floor mesh, does not move (mass=0)
+ Node node3 = createPhysicsTestNode(assetManager, new PlaneCollisionShape(new Plane(new Vector3f(0, 1, 0), 0)), 0);
+ node3.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(0f, -6, 0f));
+ rootNode.attachChild(node3);
+ getPhysicsSpace().add(node3);
+
+ }
+
+ private PhysicsSpace getPhysicsSpace() {
+ return bulletAppState.getPhysicsSpace();
+ }
+ /**
+ * creates an empty node with a RigidBodyControl
+ *
+ * @param manager for loading assets
+ * @param shape a shape for the collision object
+ * @param mass a mass for rigid body
+ * @return a new Node
+ */
+ private static Node createPhysicsTestNode(AssetManager manager, CollisionShape shape, float mass) {
+ Node node = new Node("PhysicsNode");
+ RigidBodyControl control = new RigidBodyControl(shape, mass);
+ node.addControl(control);
+ return node;
+ }
+ @Override
+ public void simpleUpdate(float tpf) {
+
+ }
+}
diff --git a/src/main/resources/RocketLeauge/assets/Models/ladaCar.j3o b/src/main/resources/RocketLeauge/assets/Models/ladaCar.j3o
new file mode 100755
index 0000000..46cffea
Binary files /dev/null and b/src/main/resources/RocketLeauge/assets/Models/ladaCar.j3o differ
diff --git a/src/main/resources/RocketLeauge/assets/Scenes/LondonTerrain.j3o b/src/main/resources/RocketLeauge/assets/Scenes/LondonTerrain.j3o
new file mode 100755
index 0000000..be36311
Binary files /dev/null and b/src/main/resources/RocketLeauge/assets/Scenes/LondonTerrain.j3o differ
diff --git a/src/main/resources/RocketLeauge/assets/Scenes/SoccerPlayGround.j3o b/src/main/resources/RocketLeauge/assets/Scenes/SoccerPlayGround.j3o
new file mode 100755
index 0000000..dc7e0d2
Binary files /dev/null and b/src/main/resources/RocketLeauge/assets/Scenes/SoccerPlayGround.j3o differ
diff --git a/src/main/resources/RocketLeauge/assets/Scenes/grassTexted231.j3o b/src/main/resources/RocketLeauge/assets/Scenes/grassTexted231.j3o
new file mode 100755
index 0000000..361b024
Binary files /dev/null and b/src/main/resources/RocketLeauge/assets/Scenes/grassTexted231.j3o differ
diff --git a/src/main/resources/RocketLeauge/assets/Textures/Dirt_Bottom-3072.jpg b/src/main/resources/RocketLeauge/assets/Textures/Dirt_Bottom-3072.jpg
new file mode 100755
index 0000000..0f64210
Binary files /dev/null and b/src/main/resources/RocketLeauge/assets/Textures/Dirt_Bottom-3072.jpg differ
diff --git a/src/main/resources/RocketLeauge/assets/Textures/Fire.png b/src/main/resources/RocketLeauge/assets/Textures/Fire.png
new file mode 100755
index 0000000..f27dd7e
Binary files /dev/null and b/src/main/resources/RocketLeauge/assets/Textures/Fire.png differ
diff --git a/src/main/resources/RocketLeauge/assets/Textures/bronzeCopperTex.jpg b/src/main/resources/RocketLeauge/assets/Textures/bronzeCopperTex.jpg
new file mode 100755
index 0000000..3af7a7e
Binary files /dev/null and b/src/main/resources/RocketLeauge/assets/Textures/bronzeCopperTex.jpg differ
diff --git a/src/main/resources/RocketLeauge/assets/Textures/carLightTex.jpg b/src/main/resources/RocketLeauge/assets/Textures/carLightTex.jpg
new file mode 100755
index 0000000..55b5611
Binary files /dev/null and b/src/main/resources/RocketLeauge/assets/Textures/carLightTex.jpg differ
diff --git a/src/main/resources/RocketLeauge/assets/Textures/carTex.jpg b/src/main/resources/RocketLeauge/assets/Textures/carTex.jpg
new file mode 100755
index 0000000..30e7ac5
Binary files /dev/null and b/src/main/resources/RocketLeauge/assets/Textures/carTex.jpg differ
diff --git a/src/main/resources/RocketLeauge/assets/Textures/metalBareTex.jpg b/src/main/resources/RocketLeauge/assets/Textures/metalBareTex.jpg
new file mode 100755
index 0000000..892ca2f
Binary files /dev/null and b/src/main/resources/RocketLeauge/assets/Textures/metalBareTex.jpg differ
diff --git a/src/main/resources/RocketLeauge/assets/Textures/sky.jpg b/src/main/resources/RocketLeauge/assets/Textures/sky.jpg
new file mode 100755
index 0000000..a6417ff
Binary files /dev/null and b/src/main/resources/RocketLeauge/assets/Textures/sky.jpg differ
diff --git a/src/main/resources/RocketLeauge/assets/Textures/soccer.jpg b/src/main/resources/RocketLeauge/assets/Textures/soccer.jpg
new file mode 100755
index 0000000..191c781
Binary files /dev/null and b/src/main/resources/RocketLeauge/assets/Textures/soccer.jpg differ
diff --git a/src/main/resources/RocketLeauge/assets/Textures/soccerTex.jpg b/src/main/resources/RocketLeauge/assets/Textures/soccerTex.jpg
new file mode 100755
index 0000000..d947db3
Binary files /dev/null and b/src/main/resources/RocketLeauge/assets/Textures/soccerTex.jpg differ