mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
3ed9edfbc6
* phy framework * phy mat * framework/index.ts * a node can have more than one collider * rename physical to physics * fix * fix * support mix ts js * fix * fix problems in issue * fix * remove RigidBodyType, add DataFlow * useGravity, freezeRotation, isKinematic * raycasts * fit buildin-world raycast options * add contact material * lint * add rigid-body-component.ts * some improvements * improvements * fix bug
27 lines
767 B
TypeScript
27 lines
767 B
TypeScript
|
|
export interface IWrappedCANNON<T> {
|
|
__cc_wrapper__: T;
|
|
}
|
|
|
|
export function setWrap<Wrapper>(cannonObject: any, wrapper: Wrapper) {
|
|
(cannonObject as unknown as IWrappedCANNON<Wrapper>).__cc_wrapper__ = wrapper;
|
|
}
|
|
|
|
export function getWrap<Wrapper>(cannonObject: any) {
|
|
return (cannonObject as unknown as IWrappedCANNON<Wrapper>).__cc_wrapper__;
|
|
}
|
|
|
|
export function toCannonOptions<T>(options: any, optionsRename?: { [x: string] : string; }) {
|
|
const result = {};
|
|
for (const key in options) {
|
|
let destKey = key;
|
|
if (optionsRename) {
|
|
const rename = optionsRename[key];
|
|
if (rename) {
|
|
destKey = rename;
|
|
}
|
|
}
|
|
result[destKey] = options[key];
|
|
}
|
|
return result as T;
|
|
} |