-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Angle constraints #837
base: master
Are you sure you want to change the base?
Angle constraints #837
Conversation
Awesome!!! While trying this out I ran into a small problem, if I try to make a pin constraint (length=0, stiffness>0.1) constrained by angles, the debug renderer breaks in |
@Prokos good catch, I couldn't reproduce the issue as I'm not sure on the setup required for it but I've accounted for that |
* master: added version targets for examples added support for example versioning in tests add support for > and >= operators in plugin version ranges
Hi @liabru is this one dead? What is missing? This would be a killer feature. |
Gonna have to bump this. This allows for axels and pins which were previously missing |
Work in progress, this feature and API is subject to change.
Features
Matter.Constraint
Usage
See the Angle Constraints example for usage. The new constraint properties are:
constraint.angleA
the target angle at point A (body-relative or world-relative depending on usage) (default0
or initial angle between points and x-axis)constraint.angleAMin
min bound, anti-clockwise relative toangleA
(radians, default0
)constraint.angleAMax
max bound, clockwise relative toangleA
(radians, default0
)constraint.angleAStiffness
the angle stiffness (0
to1
, default1
)constraint.angleB...
constraint.render.angles
boolean to render angles when usingMatter.Render
(defaulttrue
)Angles are either relative to the body, or to the world (x-axis), depending on what the constraint is connected to. For example:
constraint.bodyA
is set, thenconstraint.angleA
is relative to the body angleconstraint.pointA
is set, thenconstraint.angleA
is relative to the worldRequesting reviewers, testers and comments
If anybody has any time to help me test this update out further and feedback any issues and test cases, it would be greatly appreciated.
You can try out this feature by using the alpha build on this branch.
Known issues
Breaking changes
constraint.angleA
is nowconstraint.angleAPrev
(same for B)Changes
Matter.Constraint
objectsMatter.Constraint
moduleMatter.Render
Common.angleDiff
,Common.clampAngle