Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

physics2d supports joint2d apply #16299

Merged
merged 2 commits into from Sep 21, 2023
Merged

Conversation

lealzhan
Copy link
Contributor

@lealzhan lealzhan commented Sep 21, 2023

Re: #
https://github.com/cocos/3d-tasks/issues/17382
https://forum.cocos.org/t/topic/112160
https://forum.cocos.org/t/topic/147359

Changelog


Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

* 如果物理引擎是 box2d, 需要调用此函数来应用当前 joint 中的修改。
*/
apply (): void {
if (this._joint && this._joint.apply) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you need to check if .apply exists

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

builtin does not have this funciton

@github-actions
Copy link

github-actions bot commented Sep 21, 2023

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -46791,8 +46791,15 @@
         protected onEnable(): void;
         protected onDisable(): void;
         protected start(): void;
         protected onDestroy(): void;
+        /**
+         * @en
+         * If the physics engine is box2d, need to call this function to apply current changes to joint, this will regenerate inner box2d joint.
+         * @zh
+         * 如果物理引擎是 box2d, 需要调用此函数来应用当前 joint 中的修改。
+         */
+        apply(): void;
     }
     export class DistanceJoint2D extends Joint2D {
         TYPE: EJoint2DType;
         /**
@@ -66302,8 +66309,9 @@
         }
         export const _cocos_physics_2d_framework_components_colliders_collider_2d__Collider2D_base: new (...args: any[]) => Component & _cocos_core_event_eventify__IEventified;
         export interface _cocos_physics_2d_spec_i_physics_joint__IJoint2D extends _cocos_physics_spec_i_lifecycle__ILifecycle {
             readonly impl: any;
+            apply(): void;
             initialize(v: Joint2D): void;
         }
         export interface _cocos_physics_spec_i_physics_world__IRaycastOptions {
             mask: number;

@lealzhan lealzhan merged commit df58eb6 into cocos:v3.8.2 Sep 21, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants