fix for issue #1127 ("Reset" action in TestHoveringTank)
This commit is contained in:
parent
a4b22e4b37
commit
a91bcfd678
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009-2012 jMonkeyEngine
|
* Copyright (c) 2009-2019 jMonkeyEngine
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -80,6 +80,15 @@ public class TestHoveringTank extends SimpleApplication implements AnalogListene
|
|||||||
PointLight pl;
|
PointLight pl;
|
||||||
Geometry lightMdl;
|
Geometry lightMdl;
|
||||||
Geometry collisionMarker;
|
Geometry collisionMarker;
|
||||||
|
/**
|
||||||
|
* initial location of the tank (in world/physics-space coordinates)
|
||||||
|
*/
|
||||||
|
final private Vector3f startLocation = new Vector3f(-140f, 50f, -23f);
|
||||||
|
/**
|
||||||
|
* initial orientation of the tank (in world/physics-space coordinates)
|
||||||
|
*/
|
||||||
|
final private Quaternion startOrientation
|
||||||
|
= new Quaternion(new float[]{0f, 0.01f, 0f});
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
TestHoveringTank app = new TestHoveringTank();
|
TestHoveringTank app = new TestHoveringTank();
|
||||||
@ -143,8 +152,8 @@ public class TestHoveringTank extends SimpleApplication implements AnalogListene
|
|||||||
spaceCraft = assetManager.loadModel("Models/HoverTank/Tank2.mesh.xml");
|
spaceCraft = assetManager.loadModel("Models/HoverTank/Tank2.mesh.xml");
|
||||||
CollisionShape colShape = CollisionShapeFactory.createDynamicMeshShape(spaceCraft);
|
CollisionShape colShape = CollisionShapeFactory.createDynamicMeshShape(spaceCraft);
|
||||||
spaceCraft.setShadowMode(ShadowMode.CastAndReceive);
|
spaceCraft.setShadowMode(ShadowMode.CastAndReceive);
|
||||||
spaceCraft.setLocalTranslation(new Vector3f(-140, 50, -23));
|
spaceCraft.setLocalTranslation(startLocation);
|
||||||
spaceCraft.setLocalRotation(new Quaternion(new float[]{0, 0.01f, 0}));
|
spaceCraft.setLocalRotation(startOrientation);
|
||||||
|
|
||||||
hoverControl = new PhysicsHoverControl(colShape, 500);
|
hoverControl = new PhysicsHoverControl(colShape, 500);
|
||||||
|
|
||||||
@ -206,8 +215,10 @@ public class TestHoveringTank extends SimpleApplication implements AnalogListene
|
|||||||
} else if (binding.equals("Reset")) {
|
} else if (binding.equals("Reset")) {
|
||||||
if (value) {
|
if (value) {
|
||||||
System.out.println("Reset");
|
System.out.println("Reset");
|
||||||
hoverControl.setPhysicsLocation(new Vector3f(-140, 14, -23));
|
hoverControl.setPhysicsLocation(startLocation);
|
||||||
hoverControl.setPhysicsRotation(new Matrix3f());
|
hoverControl.setPhysicsRotation(startOrientation);
|
||||||
|
hoverControl.setAngularVelocity(Vector3f.ZERO);
|
||||||
|
hoverControl.setLinearVelocity(Vector3f.ZERO);
|
||||||
hoverControl.clearForces();
|
hoverControl.clearForces();
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user