rl-loadout-lib
Version:
Load Rocket League assets into three.js
122 lines • 4.61 kB
TypeScript
import { Bone, Color, Mesh, Object3D, Scene } from 'three';
import { AbstractObject } from '../object';
import { Body } from '../../model/body';
import { Paintable } from '../paintable';
import { Decal } from '../../model/decal';
import { PaintConfig } from '../../model/paint-config';
import { WheelSettings } from '../../model/axle-settings';
import { HitboxConfig } from '../../model/hitbox-config';
import { WheelConfig } from '../../model/wheel';
import { WheelModelInternal, WheelsModel } from '../wheel/wheels-model';
import { TopperModel } from '../topper-model';
import { AntennaModel } from '../antenna-model';
import { BodyAssets } from '../../loader/body/body-assets';
import { DecalAssets } from '../../loader/decal/decal-assets';
import { ChassisMaterial } from '../../webgl/chassis-material';
import { StaticDecalMaterial } from '../../webgl/static-decal-material';
/**
* Class that handles loading the 3D model of the car body.
*/
export declare class BodyModel extends AbstractObject implements Paintable {
private readonly body?;
protected bodyAssets?: BodyAssets;
skeleton: Bone;
bodyMesh: Mesh;
chassisMesh: Mesh;
bodyMaterial: StaticDecalMaterial;
chassisMaterial: ChassisMaterial;
hitboxConfig: HitboxConfig;
wheelSettings: WheelSettings;
wheelConfig: WheelConfig[];
wheels: WheelModelInternal[];
frontPivots: Bone[];
hatSocket: Object3D;
antennaSocket: Object3D;
wheelsModel: WheelsModel;
topperModel: TopperModel;
antennaModel: AntennaModel;
wheelRoll: number;
/**
* Create a body model object. You should **not** use this unless you know what you are doing. Use {@link createBodyModel} instead.
* @param body car body to load the model of
* @param decal car decal to load the textures of
* @param bodyAssets body assets
* @param decalAssets decal assets
* @param paints paints to be applied to the body
*/
constructor(body?: Body, decal?: Decal, bodyAssets?: BodyAssets, decalAssets?: DecalAssets, paints?: PaintConfig);
protected applyAssets(paints: PaintConfig, decalAssets: DecalAssets): void;
protected applyDecalAssets(paints: PaintConfig, decalAssets: DecalAssets): void;
dispose(): void;
protected handleModel(scene: Scene): void;
protected getWheelPositions(): void;
/**
* Add wheels to the body. This creates 4 copies of the wheel model and attaches them to the wheel joints. Replaces existing wheels.
* @param wheelsModel the wheels
*/
addWheelsModel(wheelsModel: WheelsModel): void;
private applyWheelConfig;
/**
* Remove the wheels from the body.
*/
clearWheelsModel(): void;
/**
* Add a topper to the body and attach it to the topper socket. It replaces existing toppers.
* @param topperModel the topper
*/
addTopperModel(topperModel: TopperModel): void;
/**
* Remove the topper from the body.
*/
clearTopperModel(): void;
/**
* Add an antenna to the body and attach it to the antenna anchor. It replaces existing antennas.
* @param antennaModel the antenna
*/
addAntennaModel(antennaModel: AntennaModel): void;
/**
* Remove the antenna from the body.
*/
clearAntennaModel(): void;
/**
* Set the paint color of this body.
* @param color paint color
*/
setPaintColor(color: Color): void;
/**
* Replace the current decal with a new one.
* @param decalAssets decal assets
* @param paints paint config needed for decal colors
*/
changeDecal(decalAssets: DecalAssets, paints: PaintConfig): void;
/**
* Set the primary color.
* @param color THREE Color object
*/
setPrimaryColor(color: Color): void;
/**
* Set the accent color.
* @param color THREE Color object
*/
setAccentColor(color: Color): void;
/**
* Set the paint color of the decal.
* @param color THREE Color object
*/
setDecalPaintColor(color: Color): void;
/**
* Set the yaw rotation (turn) of the front wheels.
* @param angle yaw in radians
* @param clamped if true, the angle will be clamped and the absolute value will not be higher than {@link MAX_WHEEL_YAW}
*/
setFrontWheelYaw(angle: number, clamped?: boolean): void;
/**
* Set roll rotation of the wheels.
* @param angle roll angle in radians
*/
setWheelRoll(angle: number): void;
animate(time: number): void;
protected copy(other: BodyModel): void;
clone(): BodyModel;
}
//# sourceMappingURL=body-model.d.ts.map