-
-
Notifications
You must be signed in to change notification settings - Fork 310
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
Add basic physics joint component include FixedJoint
, SpringJoint
, HingeJoint
#853
Merged
Conversation
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
/**
* A base class providing common functionality for joints.
* @decorator `@dependentComponents(Collider)`
*/
@dependentComponents(Collider)
export class Joint extends Component {
/**
* The connected collider.
*/
get connectedCollider(): Collider {}
set connectedCollider(value: Collider) {}
/**
* The scale to apply to the inverse mass of collider 0 for resolving this constraint.
*/
get connectedMassScale(): number {}
set connectedMassScale(value: number) {}
/**
* The scale to apply to the inverse inertia of collider0 for resolving this constraint.
*/
get connectedInertiaScale(): number {}
set connectedInertiaScale(value: number) {}
/**
* The scale to apply to the inverse mass of collider 1 for resolving this constraint.
*/
get massScale(): number {}
set massScale(value: number) {}
/**
* The scale to apply to the inverse inertia of collider1 for resolving this constraint.
*/
get inertiaScale(): number {}
set inertiaScale(value: number) {}
/**
* The maximum force the joint can apply before breaking.
*/
get breakForce(): number {}
set breakForce(value: number) {}
/**
* The maximum torque the joint can apply before breaking.
*/
get breakTorque(): number {}
set breakTorque(value: number) {}
}
/*
* A fixed joint permits no relative movement between two bodies. ie the bodies are glued together.
*/
export class FixedJoint extends Joint {
}
export class SpringJoint extends Joint {
/**
* The connected anchor position.
* @note If connectedCollider is set, this anchor is relative offset.
* Or the anchor is world anchor position.
*/
get connectedAnchor(): Vector3 {}
set connectedAnchor(value: Vector3) {}
/**
* The swing offset.
*/
get swingOffset(): Vector3 {}
set swingOffset(value: Vector3) {}
/**
* The minimum distance.
*/
get minDistance(): number {}
set minDistance(value: number) {}
/**
* The maximum distance.
*/
get maxDistance(): number {}
set maxDistance(value: number) {}
/**
* The distance beyond the allowed range at which the joint becomes active.
*/
get tolerance(): number {}
set tolerance(value: number) {}
/**
* The spring strength of the joint.
*/
get stiffness(): number {}
set stiffness(value: number) {}
/**
* The degree of damping of the joint spring of the joint.
*/
get damping(): number {}
set damping(value: number) {}
}
/**
* A joint which behaves in a similar way to a hinge or axle.
*/
export class HingeJoint extends Joint {
/**
* The current angle in degrees of the joint relative to its rest position.
*/
get angle(): number {}
/**
* The angular velocity of the joint in degrees per second.
*/
get velocity(): ReadOnly<Vector3> {}
/**
* The connected anchor position.
* @note If connectedCollider is set, this anchor is relative offset.
* Or the anchor is world anchor position.
*/
get connectedAnchor(): Vector3 {}
set connectedAnchor(value: Vector3) {}
/**
* The anchor rotation.
*/
get axis(): Vector3 {}
set axis(value: Vector3) {}
/**
* The swing offset.
*/
get swingOffset(): Vector3 {}
set swingOffset(value: Vector3) {}
/**
* Enables the joint's limits. Disabled by default.
*/
get useLimits(): boolean {}
set useLimits(value: boolean) {}
/**
* Limit of angular rotation (in degrees) on the hinge joint.
*/
get limits(): JointLimits {}
set limits(value: JointLimits) {}
/**
* Enables the joint's motor. Disabled by default.
*/
get useMotor(): boolean {}
set useMotor(value: boolean) {}
/**
* Enables the joint's spring. Disabled by default.
*/
get useSpring(): boolean {}
set useSpring(value: boolean) {}
/**
* The motor will apply a force up to a maximum force to achieve the target velocity in degrees per second.
*/
get motor(): JointMotor {}
set motor(value: JointMotor) {}
} |
GuoLei1990
reviewed
Jul 6, 2022
GuoLei1990
reviewed
Jul 6, 2022
GuoLei1990
reviewed
Jul 6, 2022
GuoLei1990
reviewed
Jul 6, 2022
GuoLei1990
reviewed
Jul 6, 2022
GuoLei1990
reviewed
Jul 6, 2022
GuoLei1990
reviewed
Jul 6, 2022
GuoLei1990
approved these changes
Jul 6, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
FixedJoint
, SpringJoint
, HingeJoint
4 tasks
GuoLei1990
added a commit
to GuoLei1990/galacean-engine
that referenced
this pull request
Jul 11, 2022
* dev/0.8: (28 commits) v0.8.0-alpha.3 v0.8.0-alpha.2 Use char cache mode for TextRenderer (galacean#837) Add basic physics joint component include `FixedJoint`, `SpringJoint`, `HingeJoint` (galacean#853) `InputManager` support pointer button and wheel (galacean#831) fix: TextureCube is left-hand,so x need inverse (galacean#855) Add SpriteRenderer drawMode property(support simple and sliced) (galacean#828) v0.8.0-alpha.1 v0.8.0-alpha.0 Feat(core): add more clear flag item for Camera.clearFlags (galacean#843) Fix transform`translate` and `rotate` space bug (galacean#847) Refactor `cloneTo` to `copyFrom` for math library and rename `setValue` to `set` (galacean#844) optimization camera code (galacean#830) feat: physics character controller (galacean#818) v0.7.0-beta.7 refactor: rename (galacean#827) Merge latest main (galacean#820) fix: change `region` and `pivot` origin to left-bottom (galacean#809) Fix SkyBox render mirror problem (galacean#816) feat: add `priority` for renderer to order(galacean#803) ... # Conflicts: # lerna.json # packages/core/package.json # packages/core/src/2d/dynamic-atlas/DynamicTextAtlas.ts # packages/core/src/2d/sprite/Sprite.ts # packages/core/src/2d/sprite/SpriteMask.ts # packages/core/src/2d/sprite/SpriteRenderer.ts # packages/core/src/2d/text/TextRenderer.ts # packages/core/src/Renderer.ts # packages/core/src/Transform.ts # packages/core/src/physics/index.ts # packages/design/package.json # packages/design/src/physics/IPhysics.ts # packages/draco/package.json # packages/loader/package.json # packages/loader/src/SpriteAtlasLoader.ts # packages/math/package.json # packages/math/src/CollisionUtil.ts # packages/math/src/Vector2.ts # packages/math/src/Vector3.ts # packages/math/src/Vector4.ts # packages/oasis-engine/package.json # packages/physics-lite/package.json # packages/physics-lite/src/LitePhysics.ts # packages/physics-physx/package.json # packages/physics-physx/src/PhysXPhysics.ts # packages/resource-process/package.json # packages/resource-process/tsconfig.json # packages/rhi-webgl/package.json # tests/package.json
gz65555
added a commit
that referenced
this pull request
Jul 11, 2022
* Test: Use Floss and Chai to Replace Jest (#778) test: Use Floss and Chai to Replace Jest * refactor: remove toolkit features (#780) * v0.7.0-beta.4 (#795) * Fix:local translate (#706) * fix(transform):local translate * Add component denpendent decorator (#796) * feat: add `dependentComponents` decorator * ci: remove ci on node 12 (#801) * Update README.md * Fix Test Version Error (#802) * ci: remove ci on node 12 * test: fix version * feat: add `priority` for renderer to order(#803) * feat(renderer): add `priority` for renderer to order * Fix SkyBox render mirror problem (#816) * refactor: fix skybox mirror problem * fix: change `region` and `pivot` origin to left-bottom (#809) * fix: change `region` and `pivot` origin to left-bottom * Merge latest main (#820) * v0.7.0-beta.4 * Update README.md * Update README.md * Update README.md * Add component denpendent decorator (#796) (#807) * feat: add `dependentComponents` decorator * fix(Renderer): destroy crash when material is null (#808) * Improve BlendShape when use attribute mode (#804) * feat: improve BlendShape when use attribute mode * v0.7.0-beta.5 * refactor: fix skybox mirror problem * fix: fixed the bug of animator revert when blendWeight length exceeds 4 (#817) * fix: fixed the bug of animator revert when blendWeight length exceeds 4 * v0.7.0-beta.6 * refactor: fix shader * fix(text): fix horizontal and vertical alignment error (#772) * fix(text): fix horizontal alignment error Co-authored-by: luzhuang <364439895@qq.com> Co-authored-by: singlecoder <singlecoder2014@gmail.com> * refactor: rename (#827) * v0.7.0-beta.7 * feat: physics character controller (#818) * feat: add `CharacterController` for physX backend * optimization camera code (#830) refactor: optimization camera code * Refactor `cloneTo` to `copyFrom` for math library and rename `setValue` to `set` (#844) * feat: refactor `cloneTo` to `copyFrom` for math library * feat: rename `setValue` to `set` for math library * Fix transform`translate` and `rotate` space bug (#847) * fix: transform`translate` and `rotate` space bug * refactor: opt comments * Feat(core): add more clear flag item for Camera.clearFlags (#843) * feat(core): add more clear flag item for Camera.clearFlags * v0.8.0-alpha.0 * v0.8.0-alpha.1 * Add SpriteRenderer drawMode property(support simple and sliced) (#828) * feat: add sprite draw mode(support simple and sliced) * fix: TextureCube is left-hand,so x need inverse (#855) * `InputManager` support pointer button and wheel (#831) * feat: `InputManager` support pointer button and wheel * Add basic physics joint component include `FixedJoint`, `SpringJoint`, `HingeJoint` (#853) * feat: basic physics joint * Use char cache mode for TextRenderer (#837) * feat(text): use char cache mode for TextRenderer * v0.8.0-alpha.2 * v0.8.0-alpha.3 * fix: resolve conflict * fix: resolve conflict Co-authored-by: Hu Song <gz65555@gmail.com> Co-authored-by: AZhan <njktsmshh@163.com> Co-authored-by: singlecoder <singlecoder2014@gmail.com> Co-authored-by: luzhuang <364439895@qq.com> Co-authored-by: zhuxudong <callzhuxudong@163.com> Co-authored-by: yangfengzzz <yangfengzzz@hotmail.com>
gz65555
added a commit
that referenced
this pull request
Jul 11, 2022
* fix: use string replace asset type to extend easily * fix: onEndRender trigger error * fix: remove ms blob deprecated * build: update typescript version * feat: update background mesh * refactor: add gc ignore * build: physics use oasis-engine dependency * bump version * bump version * feat: add register and reflection object * feat: add prefab parser * fix: resourceManager has't destory all cache * fix: cache promise is not clear * bump version * feat: export prefabloader * fix: dynamic explansion * feat: add mipmap generate warn * feat: add mipmap true * feat: add pixel buffer * feat: update engine version * feat: add type watch * feat: init all project * build: remove init oasis * refactor: use modelmesh encode buffer * Test: Use Floss and Chai to Replace Jest (#778) test: Use Floss and Chai to Replace Jest * refactor: remove console * refactor: add math serialize * refactor: add model mesh serialize * refactor: add scene loader * refactor: delete schema parser * refactor: add scene loader * refactor: add index * refactor: remove toolkit features (#780) * v0.7.0-beta.4 (#795) * refactor: fix types error * Fix:local translate (#706) * fix(transform):local translate * Add component denpendent decorator (#796) * feat: add `dependentComponents` decorator * ci: remove ci on node 12 (#801) * Update README.md * Fix Test Version Error (#802) * ci: remove ci on node 12 * test: fix version * feat: add `priority` for renderer to order(#803) * feat(renderer): add `priority` for renderer to order * refactor: remove useless import * Fix SkyBox render mirror problem (#816) * refactor: fix skybox mirror problem * fix: change `region` and `pivot` origin to left-bottom (#809) * fix: change `region` and `pivot` origin to left-bottom * Merge latest main (#820) * v0.7.0-beta.4 * Update README.md * Update README.md * Update README.md * Add component denpendent decorator (#796) (#807) * feat: add `dependentComponents` decorator * fix(Renderer): destroy crash when material is null (#808) * Improve BlendShape when use attribute mode (#804) * feat: improve BlendShape when use attribute mode * v0.7.0-beta.5 * refactor: fix skybox mirror problem * fix: fixed the bug of animator revert when blendWeight length exceeds 4 (#817) * fix: fixed the bug of animator revert when blendWeight length exceeds 4 * v0.7.0-beta.6 * refactor: fix shader * fix(text): fix horizontal and vertical alignment error (#772) * fix(text): fix horizontal alignment error Co-authored-by: luzhuang <364439895@qq.com> Co-authored-by: singlecoder <singlecoder2014@gmail.com> * feat: export animation type * refactor: bump version * refactor: rename (#827) * v0.7.0-beta.7 * feat: physics character controller (#818) * feat: add `CharacterController` for physX backend * optimization camera code (#830) refactor: optimization camera code * Refactor `cloneTo` to `copyFrom` for math library and rename `setValue` to `set` (#844) * feat: refactor `cloneTo` to `copyFrom` for math library * feat: rename `setValue` to `set` for math library * feat: add to Obejct * feat: remove swc core * refactor: change toJSON to toObject * Fix transform`translate` and `rotate` space bug (#847) * fix: transform`translate` and `rotate` space bug * refactor: opt comments * refactor: merge dev/0.8 * refactor: remove console * Feat(core): add more clear flag item for Camera.clearFlags (#843) * feat(core): add more clear flag item for Camera.clearFlags * v0.8.0-alpha.0 * v0.8.0-alpha.1 * feat: update resource process * Add SpriteRenderer drawMode property(support simple and sliced) (#828) * feat: add sprite draw mode(support simple and sliced) * fix: TextureCube is left-hand,so x need inverse (#855) * `InputManager` support pointer button and wheel (#831) * feat: `InputManager` support pointer button and wheel * Add basic physics joint component include `FixedJoint`, `SpringJoint`, `HingeJoint` (#853) * feat: basic physics joint * Use char cache mode for TextRenderer (#837) * feat(text): use char cache mode for TextRenderer * v0.8.0-alpha.2 * v0.8.0-alpha.3 * feat: add script parser Co-authored-by: gz65555 <kevin.hs@antgroup.com> Co-authored-by: ChenMo <gl3336563@163.com> Co-authored-by: AZhan <njktsmshh@163.com> Co-authored-by: singlecoder <singlecoder2014@gmail.com> Co-authored-by: luzhuang <364439895@qq.com> Co-authored-by: zhuxudong <callzhuxudong@163.com> Co-authored-by: yangfengzzz <yangfengzzz@hotmail.com>
gz65555
added a commit
that referenced
this pull request
Jul 20, 2022
* Test: Use Floss and Chai to Replace Jest (#778) test: Use Floss and Chai to Replace Jest * refactor: remove toolkit features (#780) * v0.7.0-beta.4 (#795) * Fix:local translate (#706) * fix(transform):local translate * Add component denpendent decorator (#796) * feat: add `dependentComponents` decorator * ci: remove ci on node 12 (#801) * Update README.md * Fix Test Version Error (#802) * ci: remove ci on node 12 * test: fix version * feat: add `priority` for renderer to order(#803) * feat(renderer): add `priority` for renderer to order * Fix SkyBox render mirror problem (#816) * refactor: fix skybox mirror problem * fix: change `region` and `pivot` origin to left-bottom (#809) * fix: change `region` and `pivot` origin to left-bottom * Merge latest main (#820) * v0.7.0-beta.4 * Update README.md * Update README.md * Update README.md * Add component denpendent decorator (#796) (#807) * feat: add `dependentComponents` decorator * fix(Renderer): destroy crash when material is null (#808) * Improve BlendShape when use attribute mode (#804) * feat: improve BlendShape when use attribute mode * v0.7.0-beta.5 * refactor: fix skybox mirror problem * fix: fixed the bug of animator revert when blendWeight length exceeds 4 (#817) * fix: fixed the bug of animator revert when blendWeight length exceeds 4 * v0.7.0-beta.6 * refactor: fix shader * fix(text): fix horizontal and vertical alignment error (#772) * fix(text): fix horizontal alignment error Co-authored-by: luzhuang <364439895@qq.com> Co-authored-by: singlecoder <singlecoder2014@gmail.com> * refactor: rename (#827) * v0.7.0-beta.7 * feat: physics character controller (#818) * feat: add `CharacterController` for physX backend * optimization camera code (#830) refactor: optimization camera code * Refactor `cloneTo` to `copyFrom` for math library and rename `setValue` to `set` (#844) * feat: refactor `cloneTo` to `copyFrom` for math library * feat: rename `setValue` to `set` for math library * Fix transform`translate` and `rotate` space bug (#847) * fix: transform`translate` and `rotate` space bug * refactor: opt comments * Feat(core): add more clear flag item for Camera.clearFlags (#843) * feat(core): add more clear flag item for Camera.clearFlags * v0.8.0-alpha.0 * v0.8.0-alpha.1 * Add SpriteRenderer drawMode property(support simple and sliced) (#828) * feat: add sprite draw mode(support simple and sliced) * fix: TextureCube is left-hand,so x need inverse (#855) * `InputManager` support pointer button and wheel (#831) * feat: `InputManager` support pointer button and wheel * Add basic physics joint component include `FixedJoint`, `SpringJoint`, `HingeJoint` (#853) * feat: basic physics joint * Use char cache mode for TextRenderer (#837) * feat(text): use char cache mode for TextRenderer * v0.8.0-alpha.2 * v0.8.0-alpha.3 * Optimization performance for `TextRenderer` to update world positions (#861) * refactor(text): optimization performance for `TextRenderer` to update world positions * Fix `InputManager` bug (#863) * fix: `pointer` position bug * fix: `pointerMovingDelta` value bug * fix: input `onPointerXX` bug not follow `Camera` cullingMask * fix(2d): `SpriteRenderer` can not show error (#865) * v0.8.0-alpha.4 * v0.8.0-alpha.5 Co-authored-by: Hu Song <gz65555@gmail.com> Co-authored-by: ChenMo <gl3336563@163.com> Co-authored-by: AZhan <njktsmshh@163.com> Co-authored-by: singlecoder <singlecoder2014@gmail.com> Co-authored-by: luzhuang <364439895@qq.com> Co-authored-by: zhuxudong <callzhuxudong@163.com> Co-authored-by: yangfengzzz <yangfengzzz@hotmail.com>
luzhuang
pushed a commit
to luzhuang/engine
that referenced
this pull request
Sep 6, 2022
…, `HingeJoint` (galacean#853) * feat: basic physics joint
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
high priority
High priority issue
physics
Engine's physical system
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
What is the current behavior? (You can also link to an open issue here)
What is the new behavior (if this is a feature change)?
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
Other information: