[功能][Spine] 补完 spine 4.2 的 PhysicsConstraint wasm 绑定#98
Conversation
- Add SPVectorPhysicsConstraintPtr using - Add DEFINE_ALLOW_RAW_POINTER for PhysicsConstraintData/PhysicsConstraint - Add REGISTER_SPINE_ENUM(Physics) - Add REGISTER_SPINE_VECTOR for physics types - Add PhysicsConstraintData/PhysicsConstraint class bindings - Add Skeleton.getPhysicsConstraints/findPhysicsConstraint - Fix SkeletonData.findPhysicsConstraint pointing to wrong function - Sync spine-core.d.ts type definitions
|
@RazgrizHsu, Please check the result of
Task Details
|
|
@RazgrizHsu, Please check the result of
Task Details
|
|
Related PR: cocos/cocos-engine-external#508 |
|
@RazgrizHsu please merge my pr to update external version |
update external version
|
我其实还有另一个想暴露的api,只是不确定是不是放一起比较好? 在 我是用在攻击动画上,但中间被打断时,就播完当前的就停止 |
|
@cocos-robot run test cases |
放在另一个pr里吧。 |
Code Size Check Report
Interface Check Report! WARNING this pull request has changed these public interfaces:
@@ -52001,8 +52001,24 @@
set(index: number, value: number);
get(index: number): number;
delete();
}
+ /**
+ * @version 4.2
+ */
+ export class SPVectorPhysicsConstraintPtr {
+ size(): number;
+ get(index: number): PhysicsConstraint;
+ delete();
+ }
+ /**
+ * @version 4.2
+ */
+ export class SPVectorPhysicsConstraintDataPtr {
+ size(): number;
+ get(index: number): PhysicsConstraintData;
+ delete();
+ }
export class Animation {
constructor(name: string, timelines: Array<Timeline>, duration: number);
duration: number;
name: string;
@@ -52645,8 +52661,12 @@
drawOrder: Array<Slot>;
ikConstraints: Array<IkConstraint>;
transformConstraints: Array<TransformConstraint>;
pathConstraints: Array<PathConstraint>;
+ /**
+ * @version 4.2
+ */
+ physicsConstraints: Array<PhysicsConstraint>;
_updateCache: Updatable[];
skin: Skin;
color: Color;
time: number;
@@ -52672,10 +52692,26 @@
setAttachment(slotName: string, attachmentName: string): void;
findIkConstraint(constraintName: string): IkConstraint;
findTransformConstraint(constraintName: string): TransformConstraint;
findPathConstraint(constraintName: string): PathConstraint;
+ /**
+ * @version 4.2
+ */
+ findPhysicsConstraint(constraintName: string): PhysicsConstraint;
+ /**
+ * @version 4.2
+ */
+ getPhysicsConstraints(): SPVectorPhysicsConstraintPtr;
//getBounds(offset: Vector2, size: Vector2, temp?: Array<number>): void;
update(delta: number): void;
+ /**
+ * @version 4.2
+ */
+ updateWorldTransform(physics: Physics): void;
+ /**
+ * @version 4.2
+ */
+ updateWorldTransform(physics: Physics, parent: Bone): void;
}
export class SkeletonBinary {
static AttachmentTypeValues: number[];
static TransformModeValues: TransformMode[];
@@ -52735,8 +52771,12 @@
animations: Animation[];
ikConstraints: IkConstraintData[];
transformConstraints: TransformConstraintData[];
pathConstraints: PathConstraintData[];
+ /**
+ * @version 4.2
+ */
+ physicsConstraints: PhysicsConstraintData[];
x: number;
y: number;
width: number;
height: number;
@@ -52758,8 +52798,16 @@
findIkConstraint(constraintName: string): IkConstraintData;
findTransformConstraint(constraintName: string): TransformConstraintData;
findPathConstraint(constraintName: string): PathConstraintData;
findPathConstraintIndex(pathConstraintName: string): number;
+ /**
+ * @version 4.2
+ */
+ findPhysicsConstraint(constraintName: string): PhysicsConstraintData;
+ /**
+ * @version 4.2
+ */
+ getPhysicsConstraints(): SPVectorPhysicsConstraintDataPtr;
}
export class SkeletonJson {
attachmentLoader: AttachmentLoader;
scale: number;
@@ -52925,8 +52973,84 @@
relative: boolean;
local: boolean;
constructor(name: string);
}
+ /**
+ * @version 4.2
+ */
+ export enum Physics {
+ none = 0,
+ reset = 1,
+ update = 2,
+ pose = 3
+ }
+ /**
+ * @version 4.2
+ */
+ export class PhysicsConstraint implements Updatable {
+ data: PhysicsConstraintData;
+ bone: Bone;
+ inertia: number;
+ strength: number;
+ damping: number;
+ massInverse: number;
+ wind: number;
+ gravity: number;
+ mix: number;
+ _reset: boolean;
+ ux: number;
+ uy: number;
+ cx: number;
+ cy: number;
+ tx: number;
+ ty: number;
+ xOffset: number;
+ xVelocity: number;
+ yOffset: number;
+ yVelocity: number;
+ rotateOffset: number;
+ rotateVelocity: number;
+ scaleOffset: number;
+ scaleVelocity: number;
+ remaining: number;
+ lastTime: number;
+ active: boolean;
+ constructor(data: PhysicsConstraintData, skeleton: Skeleton);
+ isActive(): boolean;
+ reset(): void;
+ setToSetupPose(): void;
+ update(): void;
+ translate(x: number, y: number): void;
+ rotate(x: number, y: number, degrees: number): void;
+ }
+ /**
+ * @version 4.2
+ */
+ export class PhysicsConstraintData extends ConstraintData {
+ bone: BoneData;
+ x: number;
+ y: number;
+ rotate: number;
+ scaleX: number;
+ shearX: number;
+ limit: number;
+ step: number;
+ inertia: number;
+ strength: number;
+ damping: number;
+ massInverse: number;
+ wind: number;
+ gravity: number;
+ mix: number;
+ inertiaGlobal: boolean;
+ strengthGlobal: boolean;
+ dampingGlobal: boolean;
+ massGlobal: boolean;
+ windGlobal: boolean;
+ gravityGlobal: boolean;
+ mixGlobal: boolean;
+ constructor(name: string);
+ }
export class Triangulator {
triangulate(verticesArray: ArrayLike<number>): Array<number>;
decompose(verticesArray: Array<number>, triangles: Array<number>): Array<Array<number>>;
}
|
|
@RazgrizHsu, Please check the result of
Task Details
|
|
@RazgrizHsu, Please check the result of
Task Details
|
|
@RazgrizHsu ❗ There was an error during the execution of the tasks. Please check the logs for more details. |
|
@RazgrizHsu, Please check the result of
Task Details
|
|
@RazgrizHsu, Please check the result of
Task Details
|
实际项目中需要通过代码动态控制 spine 物理约束参数(如风力、重力、惯性等),
用于角色头发飘动、衣物摆动等效果的实时调整
具体使用场景例如触摸时给
wind,gravity增加offset然后再复原, 就可以达成与spine物理系统互动
原有绑定不完整,调用 getPhysicsConstraints() 会报 UnboundTypeError,
此 PR 补完缺失的绑定
Changelog
PhysicsConstraintData/PhysicsConstraint
Continuous Integration
This pull request:
Compatibility Check
This pull request: