-
-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add physicsMaterial loader and joint component parser and change radi…
…ans to degrees in physics (#2475) * feat: add physicsMaterial loader and joint component parser and change radians to degrees in physics
- Loading branch information
Showing
27 changed files
with
290 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { | ||
resourceLoader, | ||
Loader, | ||
AssetPromise, | ||
AssetType, | ||
LoadItem, | ||
ResourceManager, | ||
PhysicsMaterial | ||
} from "@galacean/engine-core"; | ||
|
||
@resourceLoader(AssetType.PhysicsMaterial, ["mesh"]) | ||
class PhysicsMaterialLoader extends Loader<PhysicsMaterial> { | ||
load(item: LoadItem, resourceManager: ResourceManager): AssetPromise<PhysicsMaterial> { | ||
return ( | ||
resourceManager | ||
// @ts-ignore | ||
._request<any>(item.url, { | ||
...item, | ||
type: "json" | ||
}) | ||
.then((data) => { | ||
const physicsMaterial = new PhysicsMaterial(); | ||
physicsMaterial.bounciness = data.bounciness; | ||
physicsMaterial.dynamicFriction = data.dynamicFriction; | ||
physicsMaterial.staticFriction = data.staticFriction; | ||
physicsMaterial.bounceCombine = data.bounceCombine; | ||
physicsMaterial.frictionCombine = data.frictionCombine; | ||
|
||
return physicsMaterial; | ||
}) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.