MCPcopy
hub / github.com/piqnt/planck.js / constructor

Method constructor

src/common/Transform.ts:40–52  ·  view source on GitHub ↗
(position?: Vec2Value, rotation?: number)

Source from the content-addressed store, hash-verified

38 q: Rot;
39
40 constructor(position?: Vec2Value, rotation?: number) {
41 if (_CONSTRUCTOR_FACTORY && !(this instanceof Transform)) {
42 return new Transform(position, rotation);
43 }
44 this.p = Vec2.zero();
45 this.q = Rot.identity();
46 if (typeof position !== "undefined") {
47 this.p.setVec2(position);
48 }
49 if (typeof rotation !== "undefined") {
50 this.q.setAngle(rotation);
51 }
52 }
53
54 static clone(xf: Transform): Transform {
55 const obj = Object.create(Transform.prototype);

Callers

nothing calls this directly

Calls 4

setVec2Method · 0.80
zeroMethod · 0.45
identityMethod · 0.45
setAngleMethod · 0.45

Tested by

no test coverage detected