rigid wheels start
parent
e1f949ca2e
commit
82e25d6166
File diff suppressed because one or more lines are too long
|
@ -2452,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;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2678,77 +2674,51 @@ GameLib.D3.RaycastWheel.prototype.createInstance = function() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
|
||||||
)
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2898,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
|
||||||
|
|
|
@ -28,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;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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