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

Method constructor

src/collision/shape/CircleShape.ts:46–67  ·  view source on GitHub ↗
(a: any, b?: any)

Source from the content-addressed store, hash-verified

44 constructor(position: Vec2Value, radius?: number);
45 constructor(radius?: number);
46 constructor(a: any, b?: any) {
47 // @ts-ignore
48 if (_CONSTRUCTOR_FACTORY && !(this instanceof CircleShape)) {
49 return new CircleShape(a, b);
50 }
51
52 super();
53
54 this.m_type = CircleShape.TYPE;
55 this.m_p = Vec2.zero();
56 this.m_radius = 1;
57
58 if (typeof a === "object" && Vec2.isValid(a)) {
59 this.m_p.setVec2(a);
60
61 if (typeof b === "number") {
62 this.m_radius = b;
63 }
64 } else if (typeof a === "number") {
65 this.m_radius = a;
66 }
67 }
68
69 /** @hidden */
70 _serialize(): object {

Callers

nothing calls this directly

Calls 3

setVec2Method · 0.80
zeroMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected