Merge branch 'next' into feature-triMesh
commit
5075d50d6d
File diff suppressed because one or more lines are too long
|
@ -2426,17 +2426,24 @@ GameLib.D3.PolyVertex.prototype.clone = function() {
|
||||||
*
|
*
|
||||||
* @param engine GamLib.D3.Engine
|
* @param engine GamLib.D3.Engine
|
||||||
* @param chassisBody GamLib.D3.RigidBody
|
* @param chassisBody GamLib.D3.RigidBody
|
||||||
|
* @param wheels GameLib.D3.RaycastWheel[]
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.RaycastVehicle = function(
|
GameLib.D3.RaycastVehicle = function(
|
||||||
engine,
|
engine,
|
||||||
chassisBody
|
chassisBody,
|
||||||
|
wheels
|
||||||
) {
|
) {
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
this.engine.isNotCannonThrow();
|
this.engine.isNotCannonThrow();
|
||||||
|
|
||||||
this.chassisBody = chassisBody;
|
this.chassisBody = chassisBody;
|
||||||
|
|
||||||
|
if (typeof wheels == 'undefined') {
|
||||||
|
wheels = [];
|
||||||
|
}
|
||||||
|
this.wheels = wheels;
|
||||||
|
|
||||||
this.instance = this.createInstance();
|
this.instance = this.createInstance();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2445,13 +2452,9 @@ GameLib.D3.RaycastVehicle = function(
|
||||||
* @returns {GameLib.D3.RaycastVehicle|GameLib.D3.Physics.RaycastVehicle|*}
|
* @returns {GameLib.D3.RaycastVehicle|GameLib.D3.Physics.RaycastVehicle|*}
|
||||||
*/
|
*/
|
||||||
GameLib.D3.RaycastVehicle.prototype.createInstance = function() {
|
GameLib.D3.RaycastVehicle.prototype.createInstance = function() {
|
||||||
var instance = new this.engine.instance.RaycastVehicle({
|
return new this.engine.instance.RaycastVehicle({
|
||||||
chassisBody: this.chassisBody.instance
|
chassisBody: this.chassisBody.instance
|
||||||
});
|
});
|
||||||
|
|
||||||
this.instance = instance;
|
|
||||||
|
|
||||||
return instance;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2461,31 +2464,9 @@ GameLib.D3.RaycastVehicle.prototype.createInstance = function() {
|
||||||
GameLib.D3.RaycastVehicle.prototype.addWheel = function (
|
GameLib.D3.RaycastVehicle.prototype.addWheel = function (
|
||||||
wheel
|
wheel
|
||||||
) {
|
) {
|
||||||
var options = {};
|
this.wheels.push(wheel);
|
||||||
|
this.instance.addWheel(wheel.instance);
|
||||||
for (var property in wheel) {
|
|
||||||
if (wheel.hasOwnProperty(property)){
|
|
||||||
|
|
||||||
if (property == 'engine') {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
options[property] = wheel[property];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.instance.addWheel(options);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Eventually we can wrap wheels
|
|
||||||
* @returns {*}
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.RaycastVehicle.prototype.getWheelInfo = function() {
|
|
||||||
return this.instance.wheelInfos;
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.RaycastWheel = function(
|
GameLib.D3.RaycastWheel = function(
|
||||||
engine,
|
engine,
|
||||||
chassisConnectionPointLocal,
|
chassisConnectionPointLocal,
|
||||||
|
@ -2653,81 +2634,91 @@ GameLib.D3.RaycastWheel = function(
|
||||||
customSlidingRotationalSpeed = -0.1;
|
customSlidingRotationalSpeed = -0.1;
|
||||||
}
|
}
|
||||||
this.customSlidingRotationalSpeed = customSlidingRotationalSpeed;
|
this.customSlidingRotationalSpeed = customSlidingRotationalSpeed;
|
||||||
|
|
||||||
|
this.instance = this.createInstance();
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.RaycastWheel.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
return new this.engine.instance.WheelInfo({
|
||||||
|
chassisConnectionPointLocal : this.chassisConnectionPointLocal,
|
||||||
|
chassisConnectionPointWorld : this.chassisConnectionPointWorld,
|
||||||
|
directionLocal : this.directionLocal,
|
||||||
|
directionWorld : this.directionWorld,
|
||||||
|
axleLocal : this.axleLocal,
|
||||||
|
axleWorld : this.axleWorld,
|
||||||
|
suspensionRestLength : this.suspensionRestLength,
|
||||||
|
suspensionMaxLength : this.suspensionMaxLength,
|
||||||
|
radius : this.radius,
|
||||||
|
suspensionStiffness : this.suspensionStiffness,
|
||||||
|
dampingCompression : this.dampingCompression,
|
||||||
|
dampingRelaxation : this.dampingRelaxation,
|
||||||
|
frictionSlip : this.frictionSlip,
|
||||||
|
steering : this.steering,
|
||||||
|
rotation : this.rotation,
|
||||||
|
deltaRotation : this.deltaRotation,
|
||||||
|
rollInfluence : this.rollInfluence,
|
||||||
|
maxSuspensionForce : this.maxSuspensionForce,
|
||||||
|
isFrontWheel : this.isFrontWheel,
|
||||||
|
clippedInvContactDotSuspension : this.clippedInvContactDotSuspension,
|
||||||
|
suspensionRelativeVelocity : this.suspensionRelativeVelocity,
|
||||||
|
suspensionForce : this.suspensionForce,
|
||||||
|
skidInfo : this.skidInfo,
|
||||||
|
suspensionLength : this.suspensionLength,
|
||||||
|
maxSuspensionTravel : this.maxSuspensionTravel,
|
||||||
|
useCustomSlidingRotationalSpeed : this.useCustomSlidingRotationalSpeed,
|
||||||
|
customSlidingRotationalSpeed : this.customSlidingRotationalSpeed
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Physics Rigid Body Vehicle Superset
|
* Physics Rigid Body Vehicle Superset
|
||||||
* TODO: body + wheels[]
|
* @param engine
|
||||||
|
* @param chassisBody
|
||||||
|
* @param wheels
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.RigidBodyVehicle = function(
|
GameLib.D3.RigidBodyVehicle = function(
|
||||||
engine
|
engine,
|
||||||
|
chassisBody,
|
||||||
|
wheels
|
||||||
) {
|
) {
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
|
|
||||||
this.engine.isNotCannonThrow();
|
this.engine.isNotCannonThrow();
|
||||||
|
|
||||||
this.instance = null;
|
this.chassisBody = chassisBody;
|
||||||
|
|
||||||
|
if (typeof wheels == 'undefined') {
|
||||||
|
wheels = [];
|
||||||
|
}
|
||||||
|
this.wheels = wheels;
|
||||||
|
|
||||||
|
this.instance = this.createInstance();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @returns {*}
|
* @returns {GameLib.D3.RigidVehicle}
|
||||||
*/
|
*/
|
||||||
GameLib.D3.RigidBodyVehicle.prototype.getWheelInfo = function() {
|
GameLib.D3.RigidBodyVehicle.prototype.createInstance = function() {
|
||||||
return this.instance.wheelBodies;
|
return new this.engine.instance.RigidVehicle({
|
||||||
};
|
chassisBody: this.chassisBody.instance
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param chassisBody
|
|
||||||
* @returns {GameLib.D3.RigidVehicle|GameLib.D3.Physics.RigidVehicle}
|
|
||||||
*/
|
|
||||||
GameLib.D3.RigidBodyVehicle.prototype.createInstance = function(
|
|
||||||
chassisBody // Physics.RigidBody
|
|
||||||
) {
|
|
||||||
|
|
||||||
var vehicle = new this.engine.instance.RigidVehicle({
|
|
||||||
chassisBody: chassisBody.bodyObject
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.instance = vehicle;
|
|
||||||
|
|
||||||
return vehicle;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a wheel to this rigid body vehicle
|
* Adds a wheel to this rigid body vehicle
|
||||||
* @param rigidBody GameLib.D3.RigidBody
|
|
||||||
* @param position
|
|
||||||
* @param axis
|
|
||||||
* @param direction
|
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.RigidBodyVehicle.prototype.addWheel = function(
|
/**
|
||||||
rigidBody,
|
*
|
||||||
position,
|
* @param wheel
|
||||||
axis,
|
*/
|
||||||
direction
|
GameLib.D3.RigidBodyVehicle.prototype.addWheel = function(wheel) {
|
||||||
) {
|
this.wheels.push(wheel);
|
||||||
this.instance.addWheel({
|
this.instance.addWheel(wheel.instance);
|
||||||
body: rigidBody.instance,
|
|
||||||
position: new this.engine.instance.Vec3(
|
|
||||||
position.x,
|
|
||||||
position.y,
|
|
||||||
position.z
|
|
||||||
),
|
|
||||||
axis: new this.engine.instance.Vec3(
|
|
||||||
axis.x,
|
|
||||||
axis.y,
|
|
||||||
axis.z
|
|
||||||
),
|
|
||||||
direction: new this.engine.instance.Vec3(
|
|
||||||
direction.x,
|
|
||||||
direction.y,
|
|
||||||
direction.z
|
|
||||||
)
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2877,6 +2868,10 @@ GameLib.D3.RigidBody.prototype.addShape = function(
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by tj on 28.10.16.
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scenes are objects putting meshes into 'world space'
|
* Scenes are objects putting meshes into 'world space'
|
||||||
* @param id
|
* @param id
|
||||||
|
|
|
@ -2,17 +2,24 @@
|
||||||
*
|
*
|
||||||
* @param engine GamLib.D3.Engine
|
* @param engine GamLib.D3.Engine
|
||||||
* @param chassisBody GamLib.D3.RigidBody
|
* @param chassisBody GamLib.D3.RigidBody
|
||||||
|
* @param wheels GameLib.D3.RaycastWheel[]
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.RaycastVehicle = function(
|
GameLib.D3.RaycastVehicle = function(
|
||||||
engine,
|
engine,
|
||||||
chassisBody
|
chassisBody,
|
||||||
|
wheels
|
||||||
) {
|
) {
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
this.engine.isNotCannonThrow();
|
this.engine.isNotCannonThrow();
|
||||||
|
|
||||||
this.chassisBody = chassisBody;
|
this.chassisBody = chassisBody;
|
||||||
|
|
||||||
|
if (typeof wheels == 'undefined') {
|
||||||
|
wheels = [];
|
||||||
|
}
|
||||||
|
this.wheels = wheels;
|
||||||
|
|
||||||
this.instance = this.createInstance();
|
this.instance = this.createInstance();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,13 +28,9 @@ GameLib.D3.RaycastVehicle = function(
|
||||||
* @returns {GameLib.D3.RaycastVehicle|GameLib.D3.Physics.RaycastVehicle|*}
|
* @returns {GameLib.D3.RaycastVehicle|GameLib.D3.Physics.RaycastVehicle|*}
|
||||||
*/
|
*/
|
||||||
GameLib.D3.RaycastVehicle.prototype.createInstance = function() {
|
GameLib.D3.RaycastVehicle.prototype.createInstance = function() {
|
||||||
var instance = new this.engine.instance.RaycastVehicle({
|
return new this.engine.instance.RaycastVehicle({
|
||||||
chassisBody: this.chassisBody.instance
|
chassisBody: this.chassisBody.instance
|
||||||
});
|
});
|
||||||
|
|
||||||
this.instance = instance;
|
|
||||||
|
|
||||||
return instance;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,27 +40,6 @@ GameLib.D3.RaycastVehicle.prototype.createInstance = function() {
|
||||||
GameLib.D3.RaycastVehicle.prototype.addWheel = function (
|
GameLib.D3.RaycastVehicle.prototype.addWheel = function (
|
||||||
wheel
|
wheel
|
||||||
) {
|
) {
|
||||||
var options = {};
|
this.wheels.push(wheel);
|
||||||
|
this.instance.addWheel(wheel.instance);
|
||||||
for (var property in wheel) {
|
};
|
||||||
if (wheel.hasOwnProperty(property)){
|
|
||||||
|
|
||||||
if (property == 'engine') {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
options[property] = wheel[property];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.instance.addWheel(options);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Eventually we can wrap wheels
|
|
||||||
* @returns {*}
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.RaycastVehicle.prototype.getWheelInfo = function() {
|
|
||||||
return this.instance.wheelInfos;
|
|
||||||
};
|
|
|
@ -165,4 +165,40 @@ GameLib.D3.RaycastWheel = function(
|
||||||
customSlidingRotationalSpeed = -0.1;
|
customSlidingRotationalSpeed = -0.1;
|
||||||
}
|
}
|
||||||
this.customSlidingRotationalSpeed = customSlidingRotationalSpeed;
|
this.customSlidingRotationalSpeed = customSlidingRotationalSpeed;
|
||||||
|
|
||||||
|
this.instance = this.createInstance();
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.RaycastWheel.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
return new this.engine.instance.WheelInfo({
|
||||||
|
chassisConnectionPointLocal : this.chassisConnectionPointLocal,
|
||||||
|
chassisConnectionPointWorld : this.chassisConnectionPointWorld,
|
||||||
|
directionLocal : this.directionLocal,
|
||||||
|
directionWorld : this.directionWorld,
|
||||||
|
axleLocal : this.axleLocal,
|
||||||
|
axleWorld : this.axleWorld,
|
||||||
|
suspensionRestLength : this.suspensionRestLength,
|
||||||
|
suspensionMaxLength : this.suspensionMaxLength,
|
||||||
|
radius : this.radius,
|
||||||
|
suspensionStiffness : this.suspensionStiffness,
|
||||||
|
dampingCompression : this.dampingCompression,
|
||||||
|
dampingRelaxation : this.dampingRelaxation,
|
||||||
|
frictionSlip : this.frictionSlip,
|
||||||
|
steering : this.steering,
|
||||||
|
rotation : this.rotation,
|
||||||
|
deltaRotation : this.deltaRotation,
|
||||||
|
rollInfluence : this.rollInfluence,
|
||||||
|
maxSuspensionForce : this.maxSuspensionForce,
|
||||||
|
isFrontWheel : this.isFrontWheel,
|
||||||
|
clippedInvContactDotSuspension : this.clippedInvContactDotSuspension,
|
||||||
|
suspensionRelativeVelocity : this.suspensionRelativeVelocity,
|
||||||
|
suspensionForce : this.suspensionForce,
|
||||||
|
skidInfo : this.skidInfo,
|
||||||
|
suspensionLength : this.suspensionLength,
|
||||||
|
maxSuspensionTravel : this.maxSuspensionTravel,
|
||||||
|
useCustomSlidingRotationalSpeed : this.useCustomSlidingRotationalSpeed,
|
||||||
|
customSlidingRotationalSpeed : this.customSlidingRotationalSpeed
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,74 +1,48 @@
|
||||||
/**
|
/**
|
||||||
* Physics Rigid Body Vehicle Superset
|
* Physics Rigid Body Vehicle Superset
|
||||||
* TODO: body + wheels[]
|
* @param engine
|
||||||
|
* @param chassisBody
|
||||||
|
* @param wheels
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.RigidBodyVehicle = function(
|
GameLib.D3.RigidBodyVehicle = function(
|
||||||
engine
|
engine,
|
||||||
|
chassisBody,
|
||||||
|
wheels
|
||||||
) {
|
) {
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
|
|
||||||
this.engine.isNotCannonThrow();
|
this.engine.isNotCannonThrow();
|
||||||
|
|
||||||
this.instance = null;
|
this.chassisBody = chassisBody;
|
||||||
|
|
||||||
|
if (typeof wheels == 'undefined') {
|
||||||
|
wheels = [];
|
||||||
|
}
|
||||||
|
this.wheels = wheels;
|
||||||
|
|
||||||
|
this.instance = this.createInstance();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @returns {*}
|
* @returns {GameLib.D3.RigidVehicle}
|
||||||
*/
|
*/
|
||||||
GameLib.D3.RigidBodyVehicle.prototype.getWheelInfo = function() {
|
GameLib.D3.RigidBodyVehicle.prototype.createInstance = function() {
|
||||||
return this.instance.wheelBodies;
|
return new this.engine.instance.RigidVehicle({
|
||||||
};
|
chassisBody: this.chassisBody.instance
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param chassisBody
|
|
||||||
* @returns {GameLib.D3.RigidVehicle|GameLib.D3.Physics.RigidVehicle}
|
|
||||||
*/
|
|
||||||
GameLib.D3.RigidBodyVehicle.prototype.createInstance = function(
|
|
||||||
chassisBody // Physics.RigidBody
|
|
||||||
) {
|
|
||||||
|
|
||||||
var vehicle = new this.engine.instance.RigidVehicle({
|
|
||||||
chassisBody: chassisBody.bodyObject
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.instance = vehicle;
|
|
||||||
|
|
||||||
return vehicle;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a wheel to this rigid body vehicle
|
* Adds a wheel to this rigid body vehicle
|
||||||
* @param rigidBody GameLib.D3.RigidBody
|
|
||||||
* @param position
|
|
||||||
* @param axis
|
|
||||||
* @param direction
|
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.RigidBodyVehicle.prototype.addWheel = function(
|
/**
|
||||||
rigidBody,
|
*
|
||||||
position,
|
* @param wheel
|
||||||
axis,
|
*/
|
||||||
direction
|
GameLib.D3.RigidBodyVehicle.prototype.addWheel = function(wheel) {
|
||||||
) {
|
this.wheels.push(wheel);
|
||||||
this.instance.addWheel({
|
this.instance.addWheel(wheel.instance);
|
||||||
body: rigidBody.instance,
|
|
||||||
position: new this.engine.instance.Vec3(
|
|
||||||
position.x,
|
|
||||||
position.y,
|
|
||||||
position.z
|
|
||||||
),
|
|
||||||
axis: new this.engine.instance.Vec3(
|
|
||||||
axis.x,
|
|
||||||
axis.y,
|
|
||||||
axis.z
|
|
||||||
),
|
|
||||||
direction: new this.engine.instance.Vec3(
|
|
||||||
direction.x,
|
|
||||||
direction.y,
|
|
||||||
direction.z
|
|
||||||
)
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
GameLib.D3.RigidWheel = function(
|
||||||
|
engine,
|
||||||
|
position,
|
||||||
|
axis,
|
||||||
|
direction
|
||||||
|
) {
|
||||||
|
this.engine = engine;
|
||||||
|
|
||||||
|
this.position = position;
|
||||||
|
this.axis = axis;
|
||||||
|
this.direction = direction;
|
||||||
|
|
||||||
|
this.instance = this.createInstance();
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.RigidWheel.prototype.createInstance = function(
|
||||||
|
//
|
||||||
|
// body: rigidBody.instance,
|
||||||
|
// position: new this.engine.instance.Vec3(
|
||||||
|
// position.x,
|
||||||
|
// position.y,
|
||||||
|
// position.z
|
||||||
|
// ),
|
||||||
|
// axis: new this.engine.instance.Vec3(
|
||||||
|
// axis.x,
|
||||||
|
// axis.y,
|
||||||
|
// axis.z
|
||||||
|
// ),
|
||||||
|
// direction: new this.engine.instance.Vec3(
|
||||||
|
// direction.x,
|
||||||
|
// direction.y,
|
||||||
|
// direction.z
|
||||||
|
// )
|
||||||
|
);
|
Loading…
Reference in New Issue