/** * Raw RaycastWheel API object - should always correspond with the RaycastWheel Schema * @param id * @param name * @param radius * @param directionLocal * @param suspensionStiffness * @param suspensionRestLength * @param frictionSlip * @param dampingRelaxation * @param dampingCompression * @param maxSuspensionForce * @param rollInfluence * @param axleLocal * @param chassisConnectionPointLocal * @param maxSuspensionTravel * @param customSlidingRotationalSpeed * @param useCustomSlidingRotationalSpeed * @param parentEntity * @param parentMesh * @constructor */ GameLib.D3.API.RaycastWheel = function( id, name, radius, directionLocal, suspensionStiffness, suspensionRestLength, frictionSlip, dampingRelaxation, dampingCompression, maxSuspensionForce, rollInfluence, axleLocal, chassisConnectionPointLocal, maxSuspensionTravel, customSlidingRotationalSpeed, useCustomSlidingRotationalSpeed, parentMesh, parentEntity ) { if (GameLib.Utils.UndefinedOrNull(id)) { id = GameLib.Utils.RandomId(); } this.id = id; if (GameLib.Utils.UndefinedOrNull(name)) { name = 'RaycastWheel (' + this.id + ')'; } this.name = name; if (GameLib.Utils.UndefinedOrNull(radius)) { radius = 0.5; } this.radius = radius; if (GameLib.Utils.UndefinedOrNull(directionLocal)) { directionLocal = new GameLib.API.Vector3(0, 0, -1); } this.directionLocal = directionLocal; if (GameLib.Utils.UndefinedOrNull(suspensionStiffness)) { suspensionStiffness = 30; } this.suspensionStiffness = suspensionStiffness; if (GameLib.Utils.UndefinedOrNull(suspensionRestLength)) { suspensionRestLength = 0.3; } this.suspensionRestLength = suspensionRestLength; if (GameLib.Utils.UndefinedOrNull(frictionSlip)) { frictionSlip = 5; } this.frictionSlip = frictionSlip; if (GameLib.Utils.UndefinedOrNull(dampingRelaxation)) { dampingRelaxation = 2.3; } this.dampingRelaxation = dampingRelaxation; if (GameLib.Utils.UndefinedOrNull(dampingCompression)) { dampingCompression = 4.4; } this.dampingCompression = dampingCompression; if (GameLib.Utils.UndefinedOrNull(maxSuspensionForce)) { maxSuspensionForce = 100000; } this.maxSuspensionForce = maxSuspensionForce; if (GameLib.Utils.UndefinedOrNull(rollInfluence)) { rollInfluence = 0.01; } this.rollInfluence = rollInfluence; if (GameLib.Utils.UndefinedOrNull(axleLocal)) { axleLocal = new GameLib.API.Vector3(0, 1, 0); } this.axleLocal = axleLocal; if (GameLib.Utils.UndefinedOrNull(chassisConnectionPointLocal)) { chassisConnectionPointLocal = new GameLib.API.Vector3(1, 1, 0); } this.chassisConnectionPointLocal = chassisConnectionPointLocal; if (GameLib.Utils.UndefinedOrNull(maxSuspensionTravel)) { maxSuspensionTravel = 0.3; } this.maxSuspensionTravel = maxSuspensionTravel; if (GameLib.Utils.UndefinedOrNull(customSlidingRotationalSpeed)) { customSlidingRotationalSpeed = -30; } this.customSlidingRotationalSpeed = customSlidingRotationalSpeed; if (GameLib.Utils.UndefinedOrNull(useCustomSlidingRotationalSpeed)) { useCustomSlidingRotationalSpeed = true; } this.useCustomSlidingRotationalSpeed = useCustomSlidingRotationalSpeed; if (GameLib.Utils.UndefinedOrNull(parentMesh)) { parentMesh = null; } this.parentMesh = parentMesh; GameLib.API.Component.call( this, GameLib.Component.RAYCAST_WHEEL, parentEntity ); }; GameLib.D3.API.RaycastWheel.prototype = Object.create(GameLib.API.Component.prototype); GameLib.D3.API.RaycastWheel.prototype.constructor = GameLib.D3.API.RaycastWheel; /** * Creates an API RaycastWheel from an Object RaycastWheel * @param objectRaycastWheel * @constructor */ GameLib.D3.API.RaycastWheel.FromObject = function(objectRaycastWheel) { return new GameLib.D3.API.RaycastWheel( objectRaycastWheel.id, objectRaycastWheel.name, objectRaycastWheel.radius, objectRaycastWheel.directionLocal, objectRaycastWheel.suspensionStiffness, objectRaycastWheel.suspensionRestLength, objectRaycastWheel.frictionSlip, objectRaycastWheel.dampingRelaxation, objectRaycastWheel.dampingCompression, objectRaycastWheel.maxSuspensionForce, objectRaycastWheel.rollInfluence, objectRaycastWheel.axleLocal, objectRaycastWheel.chassisConnectionPointLocal, objectRaycastWheel.maxSuspensionTravel, objectRaycastWheel.customSlidingRotationalSpeed, objectRaycastWheel.useCustomSlidingRotationalSpeed, objectRaycastWheel.parentMesh, objectRaycastWheel.parentEntity ); };