Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2020 jMonkeyEngine
* Copyright (c) 2009-2021 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -514,6 +514,8 @@ protected void checkOnGround() {
/**
* This checks if the character can go from ducked to unducked state by
* doing a ray test.
*
* @return true if able to unduck, otherwise false
*/
protected boolean checkCanUnDuck() {
TempVars vars = TempVars.get();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2020 jMonkeyEngine
* Copyright (c) 2009-2021 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -76,7 +76,9 @@ public boolean isApplyPhysicsLocal() {
/**
* When set to true, the physics coordinates will be applied to the local
* translation of the Spatial
* @param applyPhysicsLocal
*
* @param applyPhysicsLocal true→match local coordinates,
* false→match world coordinates (default=false)
*/
public void setApplyPhysicsLocal(boolean applyPhysicsLocal) {
applyLocal = applyPhysicsLocal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,9 @@ private static HullCollisionShape createSingleDynamicMeshShape(Geometry geom, Sp

/**
* This method moves each child shape of a compound shape by the given vector
* @param vector
*
* @param compoundShape the shape to modify (not null)
* @param vector the offset vector (not null, unaffected)
*/
public static void shiftCompoundShapeContents(CompoundCollisionShape compoundShape, Vector3f vector) {
for (Iterator<ChildCollisionShape> it = new LinkedList<>(compoundShape.getChildren()).iterator(); it.hasNext();) {
Expand Down
7 changes: 0 additions & 7 deletions jme3-jbullet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,3 @@ dependencies {
compile project(':jme3-core')
compile project(':jme3-terrain')
}

javadoc {
// Disable doclint for JDK8+.
if (JavaVersion.current().isJava8Compatible()){
options.addStringOption('Xdoclint:none', '-quiet')
}
}
64 changes: 52 additions & 12 deletions jme3-jbullet/src/main/java/com/jme3/bullet/PhysicsSpace.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ public static PhysicsSpace getPhysicsSpace() {

/**
* Used internally
* @param space
*
* @param space which space to simulate on the current thread
*/
public static void setLocalThreadPhysicsSpace(PhysicsSpace space) {
physicsSpaceTL.set(space);
Expand Down Expand Up @@ -381,7 +382,8 @@ public void update(float time) {
/**
* updates the physics space, uses maxSteps<br>
* @param time the current time value
* @param maxSteps
* @param maxSteps the maximum number of steps of size accuracy (&ge;1) or 0
* for a single step of size timeInterval
*/
public void update(float time, int maxSteps) {
if (getDynamicsWorld() == null) {
Expand Down Expand Up @@ -413,8 +415,9 @@ public static <V> Future<V> enqueueOnThisThread(Callable<V> callable) {

/**
* calls the callable on the next physics tick (ensuring e.g. force applying)
* @param <V>
* @param callable
*
* @param <V> the return type of the Callable
* @param callable the Callable to invoke
* @return a new AppTask
*/
public <V> Future<V> enqueue(Callable<V> callable) {
Expand Down Expand Up @@ -682,15 +685,20 @@ public Collection<PhysicsVehicle> getVehicleList(){

/**
* Sets the gravity of the PhysicsSpace, set before adding physics objects!
* @param gravity
*
* @param gravity the desired acceleration vector
* (in physics-space coordinates, not null, unaffected, default=0,-10,0)
*/
public void setGravity(Vector3f gravity) {
dynamicsWorld.setGravity(Converter.convert(gravity));
}

/**
* Gets the gravity of the PhysicsSpace
* @param gravity
*
* @param gravity storage for the result (modified if not null)
* @return the acceleration vector (in physics-space coordinates, either
* gravity or a new instance)
*/
public Vector3f getGravity(Vector3f gravity) {
javax.vecmath.Vector3f tempVec = new javax.vecmath.Vector3f();
Expand All @@ -716,7 +724,8 @@ public void clearForces() {
* Adds the specified listener to the physics tick listeners.
* The listeners are called on each physics step, which is not necessarily
* each frame but is determined by the accuracy of the physics space.
* @param listener
*
* @param listener the listener to register (not null, alias created)
*/
public void addTickListener(PhysicsTickListener listener) {
tickListeners.add(listener);
Expand Down Expand Up @@ -745,8 +754,10 @@ public void removeCollisionListener(PhysicsCollisionListener listener) {
/**
* Adds a listener for a specific collision group, such a listener can disable collisions when they happen.<br>
* There can be only one listener per collision group.
* @param listener
* @param collisionGroup
*
* @param listener the listener to register (not null, alias created)
* @param collisionGroup which group it should listen for (bitmask with
* exactly one bit set)
*/
public void addCollisionGroupListener(PhysicsCollisionGroupListener listener, int collisionGroup) {
collisionGroupListeners.put(collisionGroup, listener);
Expand All @@ -758,6 +769,12 @@ public void removeCollisionGroupListener(int collisionGroup) {

/**
* Performs a ray collision test and returns the results as a list of PhysicsRayTestResults
*
* @param from the starting location (physics-space coordinates, not null,
* unaffected)
* @param to the ending location (in physics-space coordinates, not null,
* unaffected)
* @return a new list of results (not null)
*/
public List<PhysicsRayTestResult> rayTest(Vector3f from, Vector3f to) {
List<PhysicsRayTestResult> results = new LinkedList<>();
Expand All @@ -767,6 +784,13 @@ public List<PhysicsRayTestResult> rayTest(Vector3f from, Vector3f to) {

/**
* Performs a ray collision test and returns the results as a list of PhysicsRayTestResults
*
* @param from the starting location (in physics-space coordinates, not
* null, unaffected)
* @param to the ending location (in physics-space coordinates, not null,
* unaffected)
* @param results the list to hold results (not null, modified)
* @return results
*/
public List<PhysicsRayTestResult> rayTest(Vector3f from, Vector3f to, List<PhysicsRayTestResult> results) {
results.clear();
Expand Down Expand Up @@ -794,6 +818,11 @@ public float addSingleResult(LocalRayResult lrr, boolean bln) {
* Performs a sweep collision test and returns the results as a list of PhysicsSweepTestResults<br>
* You have to use different Transforms for start and end (at least distance greater than 0.4f).
* SweepTest will not see a collision if it starts INSIDE an object and is moving AWAY from its center.
*
* @param shape the shape to sweep (not null, convex, unaffected)
* @param start the starting physics-space transform (not null, unaffected)
* @param end the ending physics-space transform (not null, unaffected)
* @return a new list of results
*/
public List<PhysicsSweepTestResult> sweepTest(CollisionShape shape, Transform start, Transform end) {
List<PhysicsSweepTestResult> results = new LinkedList<>();
Expand All @@ -810,6 +839,12 @@ public List<PhysicsSweepTestResult> sweepTest(CollisionShape shape, Transform st
* Performs a sweep collision test and returns the results as a list of PhysicsSweepTestResults<br>
* You have to use different Transforms for start and end (at least distance greater than 0.4f).
* SweepTest will not see a collision if it starts INSIDE an object and is moving AWAY from its center.
*
* @param shape the shape to sweep (not null, convex, unaffected)
* @param start the starting physics-space transform (not null, unaffected)
* @param end the ending physics-space transform (not null, unaffected)
* @param results the list to hold results (not null, modified)
* @return results
*/
public List<PhysicsSweepTestResult> sweepTest(CollisionShape shape, Transform start, Transform end, List<PhysicsSweepTestResult> results) {
results.clear();
Expand Down Expand Up @@ -886,7 +921,8 @@ public float getAccuracy() {

/**
* sets the accuracy of the physics computation, default=1/60s<br>
* @param accuracy
*
* @param accuracy the desired time step (in seconds, default=1/60)
*/
public void setAccuracy(float accuracy) {
this.accuracy = accuracy;
Expand All @@ -898,7 +934,9 @@ public Vector3f getWorldMin() {

/**
* only applies for AXIS_SWEEP broadphase
* @param worldMin
*
* @param worldMin the desired minimum coordinates values (not null,
* unaffected, default=-10k,-10k,-10k)
*/
public void setWorldMin(Vector3f worldMin) {
this.worldMin.set(worldMin);
Expand All @@ -910,7 +948,9 @@ public Vector3f getWorldMax() {

/**
* only applies for AXIS_SWEEP broadphase
* @param worldMax
*
* @param worldMax the desired maximum coordinates values (not null,
* unaffected, default=10k,10k,10k)
*/
public void setWorldMax(Vector3f worldMax) {
this.worldMax.set(worldMax);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2012 jMonkeyEngine
* Copyright (c) 2009-2021 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -74,6 +74,11 @@ public void clean() {

/**
* used by event factory, called when event reused
*
* @param type the desired type
* @param source the desired first object (alias created)
* @param nodeB the desired 2nd object (alias created)
* @param cp the desired manifold (alias created)
*/
public void refactor(int type, PhysicsCollisionObject source, PhysicsCollisionObject nodeB, ManifoldPoint cp) {
this.source = source;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2019 jMonkeyEngine
* Copyright (c) 2009-2021 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -105,23 +105,27 @@ public void setCollisionGroup(int collisionGroup) {
* Add a group that this object will collide with.<br>
* Two object will collide when <b>one</b> of the parties has the
* collisionGroup of the other in its collideWithGroups set.<br>
* @param collisionGroup
*
* @param collisionGroup the groups to add, ORed together (bitmask)
*/
public void addCollideWithGroup(int collisionGroup) {
this.collisionGroupsMask = this.collisionGroupsMask | collisionGroup;
}

/**
* Remove a group from the list this object collides with.
* @param collisionGroup
*
* @param collisionGroup the groups to remove, ORed together (bitmask)
*/
public void removeCollideWithGroup(int collisionGroup) {
this.collisionGroupsMask = this.collisionGroupsMask & ~collisionGroup;
}

/**
* Directly set the bitmask for collision groups that this object collides with.
* @param collisionGroups
*
* @param collisionGroups the desired groups, ORed together (bitmask,
* default=COLLISION_GROUP_01)
*/
public void setCollideWithGroups(int collisionGroups) {
this.collisionGroupsMask = collisionGroups;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2020 jMonkeyEngine
* Copyright (c) 2009-2021 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -68,9 +68,11 @@ public CapsuleCollisionShape(float radius, float height) {

/**
* Creates a capsule shape around the given axis (0=X,1=Y,2=Z).
* @param radius
* @param height
* @param axis
*
* @param radius the desired unscaled radius
* @param height the desired unscaled height of the cylindrical portion
* @param axis which local axis for the height: 0&rarr;X, 1&rarr;Y,
* 2&rarr;Z
*/
public CapsuleCollisionShape(float radius, float height, int axis) {
this.radius=radius;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2020 jMonkeyEngine
* Copyright (c) 2009-2021 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -61,6 +61,9 @@ protected CollisionShape() {

/**
* used internally, not safe
*
* @param mass the desired mass for the body
* @param vector storage for the result (not null, modified)
*/
public void calculateLocalInertia(float mass, javax.vecmath.Vector3f vector) {
if (cShape == null) {
Expand All @@ -75,13 +78,17 @@ public void calculateLocalInertia(float mass, javax.vecmath.Vector3f vector) {

/**
* used internally
*
* @return the pre-existing instance
*/
public com.bulletphysics.collision.shapes.CollisionShape getCShape() {
return cShape;
}

/**
* used internally
*
* @param cShape the shape to use (alias created)
*/
public void setCShape(com.bulletphysics.collision.shapes.CollisionShape cShape) {
this.cShape = cShape;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ public void addChildShape(CollisionShape shape, Vector3f location) {
* adds a child shape at the given local translation
* @param shape the child shape to add
* @param location the local location of the child shape
* @param rotation the local orientation of the child shape (not null,
* unaffected)
*/
public void addChildShape(CollisionShape shape, Vector3f location, Matrix3f rotation) {
if(shape instanceof CompoundCollisionShape){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2020 jMonkeyEngine
* Copyright (c) 2009-2021 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -81,6 +81,8 @@ private void createCollisionMesh(Mesh mesh, Vector3f worldScale) {

/**
* creates a jme mesh from the collision shape, only needed for debugging
*
* @return a new Mesh
*/
public Mesh createJmeMesh(){
return Converter.convert(bulletMesh);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2020 jMonkeyEngine
* Copyright (c) 2009-2021 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -91,6 +91,8 @@ private void createCollisionMesh(Mesh mesh, Vector3f worldScale) {

/**
* creates a jme mesh from the collision shape, only needed for debugging
*
* @return a new Mesh
*/
public Mesh createJmeMesh(){
return Converter.convert(bulletMesh);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2020 jMonkeyEngine
* Copyright (c) 2009-2021 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -52,7 +52,8 @@ protected SphereCollisionShape() {

/**
* creates a SphereCollisionShape with the given radius
* @param radius
*
* @param radius the desired radius (in unscaled units)
*/
public SphereCollisionShape(float radius) {
this.radius = radius;
Expand Down
Loading