169 lines
4.1 KiB
JavaScript
169 lines
4.1 KiB
JavaScript
|
GameLib.D3.RaycastWheel = function(
|
||
|
engine,
|
||
|
chassisConnectionPointLocal,
|
||
|
chassisConnectionPointWorld,
|
||
|
directionLocal,
|
||
|
directionWorld,
|
||
|
axleLocal,
|
||
|
axleWorld,
|
||
|
suspensionRestLength,
|
||
|
suspensionMaxLength,
|
||
|
radius,
|
||
|
suspensionStiffness,
|
||
|
dampingCompression,
|
||
|
dampingRelaxation,
|
||
|
frictionSlip,
|
||
|
steering,
|
||
|
rotation,
|
||
|
deltaRotation,
|
||
|
rollInfluence,
|
||
|
maxSuspensionForce,
|
||
|
isFrontWheel,
|
||
|
clippedInvContactDotSuspension,
|
||
|
suspensionRelativeVelocity,
|
||
|
suspensionForce,
|
||
|
skidInfo,
|
||
|
suspensionLength,
|
||
|
maxSuspensionTravel,
|
||
|
useCustomSlidingRotationalSpeed,
|
||
|
customSlidingRotationalSpeed
|
||
|
) {
|
||
|
this.engine = engine;
|
||
|
this.engine.isNotCannonThrow();
|
||
|
|
||
|
if(typeof chassisConnectionPointLocal == 'undefined') {
|
||
|
chassisConnectionPointLocal = new this.engine.instance.Vec3();
|
||
|
}
|
||
|
this.chassisConnectionPointLocal = chassisConnectionPointLocal;
|
||
|
|
||
|
if(typeof chassisConnectionPointWorld == 'undefined') {
|
||
|
chassisConnectionPointWorld = new this.engine.instance.Vec3();
|
||
|
}
|
||
|
this.chassisConnectionPointWorld = chassisConnectionPointWorld;
|
||
|
|
||
|
if(typeof directionLocal == 'undefined') {
|
||
|
directionLocal = new this.engine.instance.Vec3();
|
||
|
}
|
||
|
this.directionLocal = directionLocal;
|
||
|
|
||
|
if(typeof directionWorld == 'undefined') {
|
||
|
directionWorld = new this.engine.instance.Vec3();
|
||
|
}
|
||
|
this.directionWorld = directionWorld;
|
||
|
|
||
|
if(typeof axleLocal == 'undefined') {
|
||
|
axleLocal = new this.engine.instance.Vec3();
|
||
|
}
|
||
|
this.axleLocal = axleLocal;
|
||
|
|
||
|
if(typeof axleWorld == 'undefined') {
|
||
|
axleWorld = new this.engine.instance.Vec3();
|
||
|
}
|
||
|
this.axleWorld = axleWorld;
|
||
|
|
||
|
if(typeof suspensionRestLength == 'undefined') {
|
||
|
suspensionRestLength = 1;
|
||
|
}
|
||
|
this.suspensionRestLength = suspensionRestLength;
|
||
|
|
||
|
if(typeof suspensionMaxLength == 'undefined') {
|
||
|
suspensionMaxLength = 2;
|
||
|
}
|
||
|
this.suspensionMaxLength = suspensionMaxLength;
|
||
|
|
||
|
if(typeof radius == 'undefined') {
|
||
|
radius = 1;
|
||
|
}
|
||
|
this.radius = radius;
|
||
|
|
||
|
if(typeof suspensionStiffness == 'undefined') {
|
||
|
suspensionStiffness = 100;
|
||
|
}
|
||
|
this.suspensionStiffness = suspensionStiffness;
|
||
|
|
||
|
if(typeof dampingCompression == 'undefined') {
|
||
|
dampingCompression = 10;
|
||
|
}
|
||
|
this.dampingCompression = dampingCompression;
|
||
|
|
||
|
if(typeof dampingRelaxation == 'undefined') {
|
||
|
dampingRelaxation = 10;
|
||
|
}
|
||
|
this.dampingRelaxation = dampingRelaxation;
|
||
|
|
||
|
if(typeof frictionSlip == 'undefined') {
|
||
|
frictionSlip = 10000;
|
||
|
}
|
||
|
this.frictionSlip = frictionSlip;
|
||
|
|
||
|
if(typeof steering == 'undefined') {
|
||
|
steering = 0;
|
||
|
}
|
||
|
this.steering = steering;
|
||
|
|
||
|
if(typeof rotation == 'undefined') {
|
||
|
rotation = 0;
|
||
|
}
|
||
|
this.rotation = rotation;
|
||
|
|
||
|
if(typeof deltaRotation == 'undefined') {
|
||
|
deltaRotation = 0;
|
||
|
}
|
||
|
this.deltaRotation = deltaRotation;
|
||
|
|
||
|
if(typeof rollInfluence == 'undefined') {
|
||
|
rollInfluence = 0.01;
|
||
|
}
|
||
|
this.rollInfluence = rollInfluence;
|
||
|
|
||
|
if(typeof maxSuspensionForce == 'undefined') {
|
||
|
maxSuspensionForce = Number.MAX_VALUE;
|
||
|
}
|
||
|
this.maxSuspensionForce = maxSuspensionForce;
|
||
|
|
||
|
if(typeof isFrontWheel == 'undefined') {
|
||
|
isFrontWheel = true;
|
||
|
}
|
||
|
this.isFrontWheel = isFrontWheel;
|
||
|
|
||
|
if(typeof clippedInvContactDotSuspension == 'undefined') {
|
||
|
clippedInvContactDotSuspension = 1;
|
||
|
}
|
||
|
this.clippedInvContactDotSuspension = clippedInvContactDotSuspension;
|
||
|
|
||
|
if(typeof suspensionRelativeVelocity == 'undefined') {
|
||
|
suspensionRelativeVelocity = 0;
|
||
|
}
|
||
|
this.suspensionRelativeVelocity = suspensionRelativeVelocity;
|
||
|
|
||
|
if(typeof suspensionForce == 'undefined') {
|
||
|
suspensionForce = 0;
|
||
|
}
|
||
|
this.suspensionForce = suspensionForce;
|
||
|
|
||
|
if(typeof skidInfo == 'undefined') {
|
||
|
skidInfo = 0;
|
||
|
}
|
||
|
this.skidInfo = skidInfo;
|
||
|
|
||
|
if(typeof suspensionLength == 'undefined') {
|
||
|
suspensionLength = 0;
|
||
|
}
|
||
|
this.suspensionLength = suspensionLength;
|
||
|
|
||
|
if(typeof maxSuspensionTravel == 'undefined') {
|
||
|
maxSuspensionTravel = 1;
|
||
|
}
|
||
|
this.maxSuspensionTravel = maxSuspensionTravel;
|
||
|
|
||
|
if(typeof useCustomSlidingRotationalSpeed == 'undefined') {
|
||
|
useCustomSlidingRotationalSpeed = false;
|
||
|
}
|
||
|
this.useCustomSlidingRotationalSpeed = useCustomSlidingRotationalSpeed;
|
||
|
|
||
|
if(typeof customSlidingRotationalSpeed == 'undefined') {
|
||
|
customSlidingRotationalSpeed = -0.1;
|
||
|
}
|
||
|
this.customSlidingRotationalSpeed = customSlidingRotationalSpeed;
|
||
|
};
|