Skip to content

Commit

Permalink
friction is CCFLOAT
Browse files Browse the repository at this point in the history
  • Loading branch information
longchuan committed Oct 19, 2024
1 parent 75c9870 commit ef10198
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions cocos/physics/framework/assets/physics-material.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,13 @@ export class PhysicsMaterial extends Asset {
*/
@editable
@type(CCFloat)
get friction (): number {
get friction(): number {
return this._friction;
}

set friction (value) {
if (!math.equals(this._friction, value)) {
this._friction = value;
this.emit(PhysicsMaterial.EVENT_UPDATE);
}
set friction(value) {
this._friction = value;
this.emit(PhysicsMaterial.EVENT_UPDATE);
}

/**
Expand All @@ -80,11 +78,11 @@ export class PhysicsMaterial extends Asset {
*/
@editable
@type(CCFloat)
get rollingFriction (): number {
get rollingFriction(): number {
return this._rollingFriction;
}

set rollingFriction (value) {
set rollingFriction(value) {
if (!math.equals(this._rollingFriction, value)) {
this._rollingFriction = value;
this.emit(PhysicsMaterial.EVENT_UPDATE);
Expand All @@ -99,11 +97,11 @@ export class PhysicsMaterial extends Asset {
*/
@editable
@type(CCFloat)
get spinningFriction (): number {
get spinningFriction(): number {
return this._spinningFriction;
}

set spinningFriction (value) {
set spinningFriction(value) {
if (!math.equals(this._spinningFriction, value)) {
this._spinningFriction = value;
this.emit(PhysicsMaterial.EVENT_UPDATE);
Expand All @@ -119,11 +117,11 @@ export class PhysicsMaterial extends Asset {
@editable
@type(CCFloat)
@range([0, 1, 0.01])
get restitution (): number {
get restitution(): number {
return this._restitution;
}

set restitution (value) {
set restitution(value) {
if (!math.equals(this._restitution, value)) {
this._restitution = value;
this.emit(PhysicsMaterial.EVENT_UPDATE);
Expand All @@ -145,7 +143,7 @@ export class PhysicsMaterial extends Asset {
@serializable
private _restitution = 0.0;

constructor () {
constructor() {
super();
PhysicsMaterial.allMaterials.push(this);
this.id = PhysicsMaterial._idCounter++;
Expand All @@ -158,7 +156,7 @@ export class PhysicsMaterial extends Asset {
* @zh
* 克隆。
*/
public clone (): PhysicsMaterial {
public clone(): PhysicsMaterial {
const c = new PhysicsMaterial();
c._friction = this._friction;
c._restitution = this._restitution;
Expand All @@ -174,7 +172,7 @@ export class PhysicsMaterial extends Asset {
* 销毁。
* @return 是否成功
*/
public destroy (): boolean {
public destroy(): boolean {
if (super.destroy()) {
const idx = PhysicsMaterial.allMaterials.indexOf(this);
if (idx >= 0) {
Expand All @@ -195,7 +193,7 @@ export class PhysicsMaterial extends Asset {
* @param spinningFriction
* @param restitution
*/
public setValues (friction: number, rollingFriction: number, spinningFriction: number, restitution: number): void {
public setValues(friction: number, rollingFriction: number, spinningFriction: number, restitution: number): void {
const emitUpdate = this._friction !== friction || this._rollingFriction !== rollingFriction
|| this._spinningFriction !== spinningFriction || this._restitution !== restitution;
this._friction = friction;
Expand Down

0 comments on commit ef10198

Please sign in to comment.