Java Code Examples for com.jme3.bullet.objects.VehicleWheel#setFrictionSlip()
The following examples show how to use
com.jme3.bullet.objects.VehicleWheel#setFrictionSlip() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VehicleEditorController.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void doApplyWheelData(VehicleControl control, int wheels, SuspensionSettings settings) { for (int i = 0; i < control.getNumWheels(); i++) { VehicleWheel wheel = control.getWheel(i); switch (wheels) { case 0: break; case 1: if (!wheel.isFrontWheel()) { continue; } break; case 2: if (wheel.isFrontWheel()) { continue; } break; } wheel.setRestLength(settings.getRestLength()); wheel.setMaxSuspensionForce(settings.getMaxForce()); wheel.setSuspensionStiffness(settings.getStiffness()); wheel.setRollInfluence(settings.getRollInfluence()); wheel.setWheelsDampingCompression(settings.getCompression()); wheel.setWheelsDampingRelaxation(settings.getRelease()); // wheel.setRadius(settings.getRadius()); wheel.setFrictionSlip(settings.getFriction()); } }
Example 2
Source File: SuspensionSettings.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void applyData(VehicleWheel wheel){ wheel.setRadius(getRadius()); wheel.setFrictionSlip(getFriction()); wheel.setRollInfluence(getRollInfluence()); wheel.setMaxSuspensionForce(getMaxForce()); wheel.setSuspensionStiffness(getStiffness()); wheel.setWheelsDampingCompression(getCompression()); wheel.setWheelsDampingRelaxation(getRelease()); }
Example 3
Source File: VehicleControl.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * Create a shallow clone for the JME cloner. * * @return a new control (not null) */ @Override public Object jmeClone() { VehicleControl control = new VehicleControl(collisionShape, mass); control.setAngularFactor(getAngularFactor()); control.setAngularSleepingThreshold(getAngularSleepingThreshold()); control.setAngularVelocity(getAngularVelocity()); control.setCcdMotionThreshold(getCcdMotionThreshold()); control.setCcdSweptSphereRadius(getCcdSweptSphereRadius()); control.setCollideWithGroups(getCollideWithGroups()); control.setCollisionGroup(getCollisionGroup()); control.setContactResponse(isContactResponse()); control.setDamping(getLinearDamping(), getAngularDamping()); control.setFriction(getFriction()); control.setGravity(getGravity()); control.setKinematic(isKinematic()); control.setLinearSleepingThreshold(getLinearSleepingThreshold()); control.setLinearVelocity(getLinearVelocity()); control.setPhysicsLocation(getPhysicsLocation()); control.setPhysicsRotation(getPhysicsRotationMatrix()); control.setRestitution(getRestitution()); control.setFrictionSlip(getFrictionSlip()); control.setMaxSuspensionTravelCm(getMaxSuspensionTravelCm()); control.setSuspensionStiffness(getSuspensionStiffness()); control.setSuspensionCompression(tuning.suspensionCompression); control.setSuspensionDamping(tuning.suspensionDamping); control.setMaxSuspensionForce(getMaxSuspensionForce()); for (Iterator<VehicleWheel> it = wheels.iterator(); it.hasNext();) { VehicleWheel wheel = it.next(); VehicleWheel newWheel = control.addWheel(wheel.getLocation(), wheel.getDirection(), wheel.getAxle(), wheel.getRestLength(), wheel.getRadius(), wheel.isFrontWheel()); newWheel.setFrictionSlip(wheel.getFrictionSlip()); newWheel.setMaxSuspensionTravelCm(wheel.getMaxSuspensionTravelCm()); newWheel.setSuspensionStiffness(wheel.getSuspensionStiffness()); newWheel.setWheelsDampingCompression(wheel.getWheelsDampingCompression()); newWheel.setWheelsDampingRelaxation(wheel.getWheelsDampingRelaxation()); newWheel.setMaxSuspensionForce(wheel.getMaxSuspensionForce()); // Copy the wheel spatial reference directly for now. They'll // get fixed up in the cloneFields() method newWheel.setWheelSpatial(wheel.getWheelSpatial()); } control.setApplyPhysicsLocal(isApplyPhysicsLocal()); control.setEnabled(isEnabled()); control.spatial = spatial; return control; }
Example 4
Source File: VehicleControl.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
public Control cloneForSpatial(Spatial spatial) { VehicleControl control = new VehicleControl(collisionShape, mass); control.setAngularFactor(getAngularFactor()); control.setAngularSleepingThreshold(getAngularSleepingThreshold()); control.setAngularVelocity(getAngularVelocity()); control.setCcdMotionThreshold(getCcdMotionThreshold()); control.setCcdSweptSphereRadius(getCcdSweptSphereRadius()); control.setCollideWithGroups(getCollideWithGroups()); control.setCollisionGroup(getCollisionGroup()); control.setDamping(getLinearDamping(), getAngularDamping()); control.setFriction(getFriction()); control.setGravity(getGravity()); control.setKinematic(isKinematic()); control.setLinearSleepingThreshold(getLinearSleepingThreshold()); control.setLinearVelocity(getLinearVelocity()); control.setPhysicsLocation(getPhysicsLocation()); control.setPhysicsRotation(getPhysicsRotationMatrix()); control.setRestitution(getRestitution()); control.setFrictionSlip(getFrictionSlip()); control.setMaxSuspensionTravelCm(getMaxSuspensionTravelCm()); control.setSuspensionStiffness(getSuspensionStiffness()); control.setSuspensionCompression(tuning.suspensionCompression); control.setSuspensionDamping(tuning.suspensionDamping); control.setMaxSuspensionForce(getMaxSuspensionForce()); for (Iterator<VehicleWheel> it = wheels.iterator(); it.hasNext();) { VehicleWheel wheel = it.next(); VehicleWheel newWheel = control.addWheel(wheel.getLocation(), wheel.getDirection(), wheel.getAxle(), wheel.getRestLength(), wheel.getRadius(), wheel.isFrontWheel()); newWheel.setFrictionSlip(wheel.getFrictionSlip()); newWheel.setMaxSuspensionTravelCm(wheel.getMaxSuspensionTravelCm()); newWheel.setSuspensionStiffness(wheel.getSuspensionStiffness()); newWheel.setWheelsDampingCompression(wheel.getWheelsDampingCompression()); newWheel.setWheelsDampingRelaxation(wheel.getWheelsDampingRelaxation()); newWheel.setMaxSuspensionForce(wheel.getMaxSuspensionForce()); //TODO: bad way finding children! if (spatial instanceof Node) { Node node = (Node) spatial; Spatial wheelSpat = node.getChild(wheel.getWheelSpatial().getName()); if (wheelSpat != null) { newWheel.setWheelSpatial(wheelSpat); } } } control.setApplyPhysicsLocal(isApplyPhysicsLocal()); control.setSpatial(spatial); return control; }
Example 5
Source File: VehicleControl.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
public Control cloneForSpatial(Spatial spatial) { VehicleControl control = new VehicleControl(collisionShape, mass); control.setAngularFactor(getAngularFactor()); control.setAngularSleepingThreshold(getAngularSleepingThreshold()); control.setAngularVelocity(getAngularVelocity()); control.setCcdMotionThreshold(getCcdMotionThreshold()); control.setCcdSweptSphereRadius(getCcdSweptSphereRadius()); control.setCollideWithGroups(getCollideWithGroups()); control.setCollisionGroup(getCollisionGroup()); control.setDamping(getLinearDamping(), getAngularDamping()); control.setFriction(getFriction()); control.setGravity(getGravity()); control.setKinematic(isKinematic()); control.setLinearSleepingThreshold(getLinearSleepingThreshold()); control.setLinearVelocity(getLinearVelocity()); control.setPhysicsLocation(getPhysicsLocation()); control.setPhysicsRotation(getPhysicsRotationMatrix()); control.setRestitution(getRestitution()); control.setFrictionSlip(getFrictionSlip()); control.setMaxSuspensionTravelCm(getMaxSuspensionTravelCm()); control.setSuspensionStiffness(getSuspensionStiffness()); control.setSuspensionCompression(tuning.suspensionCompression); control.setSuspensionDamping(tuning.suspensionDamping); control.setMaxSuspensionForce(getMaxSuspensionForce()); for (Iterator<VehicleWheel> it = wheels.iterator(); it.hasNext();) { VehicleWheel wheel = it.next(); VehicleWheel newWheel = control.addWheel(wheel.getLocation(), wheel.getDirection(), wheel.getAxle(), wheel.getRestLength(), wheel.getRadius(), wheel.isFrontWheel()); newWheel.setFrictionSlip(wheel.getFrictionSlip()); newWheel.setMaxSuspensionTravelCm(wheel.getMaxSuspensionTravelCm()); newWheel.setSuspensionStiffness(wheel.getSuspensionStiffness()); newWheel.setWheelsDampingCompression(wheel.getWheelsDampingCompression()); newWheel.setWheelsDampingRelaxation(wheel.getWheelsDampingRelaxation()); newWheel.setMaxSuspensionForce(wheel.getMaxSuspensionForce()); //TODO: bad way finding children! if (spatial instanceof Node) { Node node = (Node) spatial; Spatial wheelSpat = node.getChild(wheel.getWheelSpatial().getName()); if (wheelSpat != null) { newWheel.setWheelSpatial(wheelSpat); } } } control.setApplyPhysicsLocal(isApplyPhysicsLocal()); control.setSpatial(spatial); return control; }