Modifying the value of b2_maxTranslation in box2d.umd.js can change the upper limit of the rigid body speed, but this is only effective for box2d and not for box2d-wasm. How can I modify the upper limit of the rigid body speed of box2d-wasm?
If the Android app is your own, you can do this. The Android part needs to be written by your Android engineers.
/**
* 初始化cocos 往网页注入的方法
*这是游戏端需要先往window对象注入方法
*/
public static initGameLogic() {
if (this.getIsAndroid()) {
if (!window.android) {
window.android = {} as AndroidInterface
}
window.android.refreshBalance = () => {
EventManager.dispatch(E_AppNoticeEvent.e_refreshBalance)
}
window.android.joinBack = (isSuccess: boolean) => {
if (isSuccess) {
EventManager.dispatch(E_AppNoticeEvent.e_joinVoiceRoom)
} else {
this.showToast("JOIN VOICE FAIL", 2000)
}
}
window.android.speakUser = (userId: string) => {
EventManager.dispatch(E_AppNoticeEvent.e_speakerUserId, userId)
}
window.android.stopSpeakUser = (userId: string) => {
EventManager.dispatch(E_AppNoticeEvent.e_stopSpeakerUserId, userId)
}
window.android.isShowGame = (isShowGame: boolean) => {
this.log("安卓通知前后台:", isShowGame)
if (isShowGame) {
this.curIsBackground = false
this.showGame()
} else {
this.curIsBackground = true
this.hideGame()
}
}
} else {
if (!window.ios) {
window.ios = {} as IosInterface
}
window.ios.backToken = (token: string) => {
this.log("ios返回token", token)
this._playerToken = token
if (this.curIsBackground === false) {
SocketIO.toConnect()
}
}
window.ios.backIsBackground = (isBackground: string) => {
this.log("ios返回前后台", isBackground, typeof (isBackground))
if (Number(isBackground)) {
this.curIsBackground = true
} else {
this.curIsBackground = false
SocketIO.toConnect()
}
}
window.ios.refreshBalance = () => {
this.log("刷新余额")
EventManager.dispatch(E_AppNoticeEvent.e_refreshBalance)
}
window.ios.joinBack = (isSuccess: string) => {
this.log("加入房间是否成功", isSuccess)
if (Number(isSuccess)) {
EventManager.dispatch(E_AppNoticeEvent.e_joinVoiceRoom)
} else {
this.showToast("JOIN VOICE FAIL", 2000)
}
}
window.ios.speakUser = (userId: string) => {
EventManager.dispatch(E_AppNoticeEvent.e_speakerUserId, userId)
}
window.ios.stopSpeakUser = (userId: string) => {
EventManager.dispatch(E_AppNoticeEvent.e_stopSpeakerUserId, userId)
}
window.ios.isShowGame = (isShowGame: string) => {
this.log("ios通知前后台:", isShowGame)
if (Number(isShowGame)) {
//在苹果上进入多任务会通知进这里
if (this.curIsBackground) {
this.curIsBackground = false
this.showGame()
}
} else {
this.curIsBackground = true
this.hideGame()
}
}
}
this.log("Token:", this.getPlayerToken())
this.log("当前是前台:", this.getIsCanConnect())
this.log("SocketUrl:", this.getSocketIOUrl())
this.log("头像cdn地址:", this.getImgCdn())
this.log("是否是debug模式:", DEBUG)
this.log("是否是测试服Url:", this.getIsDebugEnv())
this.log("当前设备实际环境:", this.getPracticalPlatform())
this.log("游戏版本号:", this.getVersion())
this.log("是否有获取前后台方法:", Boolean(window.android && window.android.getIsBackground))
}
It is now easier for the game client to call Android methods
window.android.starBGM(volume)
and get the return value