Files
GDevelop/GDJS/Runtime/CustomRuntimeObject2D.ts
D8H 3568a58019 Allow custom objects to be used as 3D objects (#6369)
- Custom objects like the 3D particle emitter can be used as any other 3D object
  - with the same set of actions and conditions thanks to the 3D capability
  - in the scene editor, their Z position and 3D rotations can be changed
- Fix child creation in `doStepPostEvent` function
2024-03-05 13:51:41 +01:00

36 lines
942 B
TypeScript

namespace gdjs {
/**
* Base class for 2D custom objects.
*/
export class CustomRuntimeObject2D extends gdjs.CustomRuntimeObject {
constructor(
parent: gdjs.RuntimeInstanceContainer,
objectData: ObjectData & CustomObjectConfiguration
) {
super(parent, objectData);
this.getRenderer().reinitialize(this, parent);
}
protected _createRender(): gdjs.CustomRuntimeObject2DRenderer {
const parent = this._runtimeScene;
return new gdjs.CustomRuntimeObject2DRenderer(
this,
this._instanceContainer,
parent
);
}
protected _reinitializeRenderer(): void {
this.getRenderer().reinitialize(this, this.getParent());
}
getRenderer(): gdjs.CustomRuntimeObject2DRenderer {
return super.getRenderer() as gdjs.CustomRuntimeObject2DRenderer;
}
getRendererObject() {
return this.getRenderer().getRendererObject();
}
}
}