jMonkeyEngine / jMonkeyEngine/jmonkeyengine
RigidBodyControl and VehicleControl don't clone linear factors
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.3k
- Forks
- 1.2k
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 14
Description
The following test fails in master jme3-bullet because the controls are incompletely cloned. It'll be tricky to fix this because the control classes are common (to both jme3-bullet and jme3-jbullet) and jme3-jbullet doesn't implement getLinearFactor().
package jme3test.bullet;
import com.jme3.app.SimpleApplication;
import com.jme3.bullet.collision.shapes.CollisionShape;
import com.jme3.bullet.collision.shapes.SphereCollisionShape;
import com.jme3.bullet.control.RigidBodyControl;
import com.jme3.bullet.control.VehicleControl;
import com.jme3.bullet.objects.PhysicsRigidBody;
import com.jme3.math.Vector3f;
import com.jme3.util.clone.Cloner;
/**
* Test cloning of linear factors on RigidBodyControl and VehicleControl.
*
* @author Stephen Gold sgold@sonic.net
*/
public class TestIssueXXX extends SimpleApplication {
public static void main(String[] args) {
TestIssueXXX app = new TestIssueXXX();
app.start();
}
@Override
public void simpleInitApp() {
CollisionShape shape = new SphereCollisionShape(1f);
/*
* RigidBodyControl
*/
RigidBodyControl rbc = new RigidBodyControl(shape, 1f);
rbc.setLinearFactor(new Vector3f(0.14f, 0.15f, 0.16f));
verifyParameters(rbc);
RigidBodyControl rbcClone = (RigidBodyControl) Cloner.deepClone(rbc);
verifyParameters(rbcClone);
/*
* VehicleControl
*/
VehicleControl vc = new VehicleControl(shape, 1f);
rbc.setLinearFactor(new Vector3f(0.14f, 0.15f, 0.16f));
verifyParameters(vc);
VehicleControl vcClone = (VehicleControl) Cloner.deepClone(vc);
verifyParameters(vcClone);
stop();
}
// *************************************************************************
// private methods
private void verifyParameters(PhysicsRigidBody body) {
Vector3f f = body.getLinearFactor();
assert f.x == 0.14f : f;
assert f.y == 0.15f : f;
assert f.z == 0.16f : f;
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with RigidBodyControl, VehicleControl, and PhysicsRigidBody, then compare their cloning behavior in jme3-bullet and jme3-jbullet, where getLinearFactor() is not implemented in the latter. Run the supplied TestIssueXXX case and verify that deep-cloned controls preserve all three linear-factor values in both implementations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100