hxhieu / playcanvas-typescript-template

PlayCanvas 2.0 local development with TS
MIT License
4 stars 1 forks source link

this.entity.setPosition(Vec3.LEFT) results in "nan" position values #12

Open ma-vejsada opened 2 years ago

ma-vejsada commented 2 years ago

this script:

import { createScript } from "../../extensions/create-script-decorator";
import { ScriptTypeBase } from "../../extensions/script-type-base";
import { IAttributeCollection } from "../../@types/system";
import { Vec3 } from "playcanvas";

@createScript()
export class HelloWorld extends ScriptTypeBase implements pc.ScriptType {
  name = 'ABC'

  initialize() {
    this.entity.setPosition(Vec3.LEFT);
    console.log(this.entity.getPosition());
  }
}

results in position: Object { x: NaN, y: NaN, z: NaN }

or

import { createScript } from "../../extensions/create-script-decorator";
import { ScriptTypeBase } from "../../extensions/script-type-base";
import { IAttributeCollection } from "../../@types/system";
import pc from "playcanvas";

@createScript()
export class HelloWorld extends ScriptTypeBase implements pc.ScriptType {
  name = 'ABC'

  initialize() {
    this.entity.setPosition(pc.Vec3.LEFT);
    console.log(this.entity.getPosition());
  }
}

results in error: n.default is undefined

Step to reproduce:

hxhieu commented 2 years ago

@ma-vejsada I have not updated this template for a long time and this might be related to the new API over there on the PC editor.

I am sorry but I have no ETA for this but contributions are welcome.

Thanks!

ma-vejsada commented 2 years ago

Nevermind, I just wanted to let you know.

Thanks.