You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a typescript error when I am trying to create RandomZone for ParticlesEmitter.
Example Test Code
const emitRect = new Phaser.Geom.Rectangle()
new Phaser.GameObjects.Particles.Zones.RandomZone(emitRect)
Error:
Argument of type 'Rectangle' is not assignable to parameter of type 'RandomZoneSource'.
Types of property 'getRandomPoint' are incompatible.
Type '(point?: O | undefined) => O' is not assignable to type 'RandomZoneSourceCallback'.
Types of parameters 'point' and 'point' are incompatible.
Type 'Vector2Like' is missing the following properties from type 'Point': type, setTo
Additional Information
The text was updated successfully, but these errors were encountered:
Looks like the RandomZoneSourceCallback's parameter is typed as Phaser.Types.Math.Vector2Like whereas the emitRect's getRandomPoint function returns type Phaser.Geom.Point.
As a workaround you could do something like
const emitRect = new Phaser.Geom.Rectangle();
new Phaser.GameObjects.Particles.Zones.RandomZone({
getRandomPoint: () => emitRect.getRandomPoint()
});
We will address this after the v3.85 release. We're going to remove the Point class and swap to using Vec2 everywhere instead, which will fix this. Until then, please use the workaround above.
Version
Description
There is a typescript error when I am trying to create RandomZone for ParticlesEmitter.
Example Test Code
Error:
Additional Information
The text was updated successfully, but these errors were encountered: