File tree Expand file tree Collapse file tree 4 files changed +15
-5
lines changed Expand file tree Collapse file tree 4 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,10 @@ export class Entity {
39
39
return prop . box
40
40
}
41
41
42
+ destroyNetworkProp ( key ) {
43
+ delete this . props [ key ]
44
+ }
45
+
42
46
sendNetworkUpdate ( ) {
43
47
const data = {
44
48
id : this . id ,
Original file line number Diff line number Diff line change @@ -211,9 +211,9 @@ export class Object extends Entity {
211
211
this . decHot ( this . hotEvents )
212
212
this . hotEvents = 0
213
213
// clear script vars
214
- // for (let i = 0; i < this.scriptVarIds; i++) {
215
- // this.destroyVar(`$ ${i}`)
216
- // }
214
+ for ( let i = 0 ; i < this . scriptVarIds ; i ++ ) {
215
+ this . destroyNetworkProp ( `__ ${ i } `)
216
+ }
217
217
this . scriptVarIds = 0
218
218
// reconstruct
219
219
if ( this . isUploading ( ) ) {
Original file line number Diff line number Diff line change @@ -90,26 +90,28 @@ export class Physics extends System {
90
90
}
91
91
const result = this . contactsResult . get ( )
92
92
if ( ! handle0 . contactedHandles . has ( handle1 ) ) {
93
- result . entityId = handle1 . entityId
94
93
result . tag = handle1 . tag
94
+ result . isAuthority = handle1 . isAuthority
95
95
handle0 . onContactStart ?. ( result )
96
96
handle0 . contactedHandles . add ( handle1 )
97
97
}
98
98
if ( ! handle1 . contactedHandles . has ( handle0 ) ) {
99
- result . entityId = handle0 . entityId
100
99
result . tag = handle0 . tag
100
+ result . isAuthority = handle0 . isAuthority
101
101
handle1 . onContactStart ?. ( result )
102
102
handle1 . contactedHandles . add ( handle0 )
103
103
}
104
104
} else if ( pair . events . isSet ( PHYSX . PxPairFlagEnum . eNOTIFY_TOUCH_LOST ) ) {
105
105
const result = this . contactsResult . get ( )
106
106
if ( handle0 . contactedHandles . has ( handle1 ) ) {
107
107
result . tag = handle1 . tag
108
+ result . isAuthority = handle1 . isAuthority
108
109
handle0 . onContactEnd ?. ( result )
109
110
handle0 . contactedHandles . delete ( handle1 )
110
111
}
111
112
if ( handle1 . contactedHandles . has ( handle0 ) ) {
112
113
result . tag = handle0 . tag
114
+ result . isAuthority = handle0 . isAuthority
113
115
handle1 . onContactEnd ?. ( result )
114
116
handle1 . contactedHandles . delete ( handle0 )
115
117
}
Original file line number Diff line number Diff line change @@ -68,9 +68,13 @@ export class RigidBody extends Node {
68
68
const self = this
69
69
this . removeActor = this . ctx . world . physics . addActor ( this . actor , {
70
70
onInterpolate : this . type === 'kinematic' || this . type === 'dynamic' ? this . onInterpolate : null ,
71
+
71
72
get tag ( ) {
72
73
return self . tag
73
74
} ,
75
+ get isAuthority ( ) {
76
+ return self . ctx . entity . isAuthority ( )
77
+ } ,
74
78
get onContactStart ( ) {
75
79
return self . onContactStart
76
80
} ,
You can’t perform that action at this time.
0 commit comments