A collection of camera controllers for JMonkeyEngine
BSD-3-CLAUSE License
The Garrett Project provides a collection of camera controllers for the jMonkeyEngine (JME) game engine.
It contains 2 subprojects:
Complete source code (in Java) is provided under a 3-clause BSD license.
AffixedCamera
: affixes a camera to a rigid body at a specific offset.
The controlled camera moves with the rigid body as it translates and rotates.
DynamicCamera
: a physics-based, 6 degree-of-freedom camera controller.
The controlled camera is enclosed in a spherical rigid body
that prevents it from penetrating other bodies.
OrbitCamera
: a physics-based, 4 degree-of-freedom camera controller.
The controlled camera orbits a specified target,
optionally clipping or jumping forward
to maintain a clear line of sight in the target's CollisionSpace.
A continuum of chasing behaviors is implemented.
Garrett comes pre-built as a single JVM library that depends on Minie. However, the Minie dependency is intentionally omitted from Garrett's POM so developers can specify which Minie library should be used.
For projects built using Maven or Gradle, it is not sufficient to specify the dependency on Garrett. You must also explicitly specify the Minie dependency. The following examples specify "+big4", but "+debug" or the default Minie library should also work.
Add to the project’s "build.gradle" or "build.gradle.kts" file:
repositories {
mavenCentral()
}
dependencies {
implementation("com.github.stephengold:Garrett:0.5.3")
implementation("com.github.stephengold:Minie:8.1.0+big4")
}
For some older versions of Gradle,
it's necessary to replace implementation
with compile
.
Add to the project’s "pom.xml" file:
<repositories>
<repository>
<id>mvnrepository</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.stephengold</groupId>
<artifactId>Garrett</artifactId>
<version>0.5.3</version>
</dependency>
<dependency>
<groupId>com.github.stephengold</groupId>
<artifactId>Minie</artifactId>
<version>8.1.0+big4</version>
</dependency>
JAVA_HOME
environment variable to your JDK installation:export JAVA_HOME="
path to installation "
set -g JAVA_HOME "
path to installation "
set JAVA_HOME="
path to installation "
$env:JAVA_HOME = '
path to installation '
git clone https://github.com/stephengold/Garrett.git
cd Garrett
git checkout -b latest 0.5.3
cd
to the extracted directory/folder./gradlew build
.\gradlew build
After a successful build, Maven artifacts will be found in "GarrettLibrary/build/libs".
You can install the artifacts to your local Maven repository:
./gradlew install
.\gradlew install
You can restore the project to a pristine state:
./gradlew clean
.\gradlew clean
Library classes are in the com.github.stephengold.garrett
package.
Example classes are in the com.github.stephengold.garrett.examples
package.
The source code and pre-built libraries are compatible with JDK 8.
Applications have been created to test and demonstrate certain features of Garrett. The following apps are found in the GarrettExamples subproject:
A very simple example of how Garrett maps keys to input signals.
Using AffixedCamera
, the camera stays at a fixed offset from the red sphere.
An example of a camera controlled by DynamicCamera
.
An example of a camera controlled by OrbitCamera
.
The camera orbits the red ball, which is its target.
Like most projects, the Garrett Project builds on the work of many who have gone before. I therefore acknowledge the creators of (and contributors to) the following software:
I am grateful to GitHub and Sonatype for providing free hosting for this project and many other open-source projects.
I'm also grateful to my dear Holly, for keeping me sane.
If I've misattributed anything or left anyone out, please let me know, so I can correct the situation: [email protected]