VPivotJoint¶
Qualified name: manim\_pymunk.constraints.VPivotJoint
- class VPivotJoint(a_mob, b_mob, pivot_world=None, anchor_a_local=array([0., 0., 0.]), anchor_b_local=array([0., 0., 0.]), anchor_a_appearance=Dot, anchor_b_appearance=Dot, pivot_appearance=Dot, connect_line_class=<class 'manim.mobject.geometry.line.Line'>, connect_line_config={'color': ManimColor('#F7D96F'), 'stroke_width': 2}, **kwargs)[source]¶
Bases:
VConstraintA pivot joint allows two rigid bodies to rotate freely around a common pivot point. The pivot point acts as an axis of rotation, ensuring that both bodies remain attached at the specified position regardless of external forces.
Please configure pivot_world or (anchor_a_loca, anchor_b_local).
Parameters¶
- a_mob
The first Mobject to be connected.
- b_mob
The second Mobject to be connected.
- pivot_world
The global coordinate position of the pivot point. If provided, anchor_a_local and anchor_b_local are calculated automatically based on this.
- anchor_a_local
The local anchor point on a_mob corresponding to the pivot, relative to the Mobject’s center.
- anchor_b_local
The local anchor point on b_mob corresponding to the pivot, relative to the Mobject’s center.
- pivot_appearance
The Mobject used to visually represent the pivot point (defaults to a white Dot with 0.05 radius).
Examples¶
Example: VPivotJointExample ¶
from manim import * from manim_pymunk import * class VPivotJointExample(SpaceScene): def construct(self): static_dot = Dot(ORIGIN) square = Square().move_to(static_dot) square2 = Square().move_to(static_dot.get_center() + UP * 2).scale(0.5) constraints = [ VPivotJoint(static_dot, square), VPivotJoint( square, square2, pivot_world= UP*3, ), ] self.add_static_body(static_dot) self.add_dynamic_body(square, square2, angular_velocity=PI * 2) self.add_shapes_filter(static_dot, square, square2, group=2) self.add_constraints(*constraints) self.wait(3)
from manim_pymunk import * class VPivotJointExample(SpaceScene): def construct(self): static_dot = Dot(ORIGIN) square = Square().move_to(static_dot) square2 = Square().move_to(static_dot.get_center() + UP * 2).scale(0.5) constraints = [ VPivotJoint(static_dot, square), VPivotJoint( square, square2, pivot_world= UP*3, ), ] self.add_static_body(static_dot) self.add_dynamic_body(square, square2, angular_velocity=PI * 2) self.add_shapes_filter(static_dot, square, square2, group=2) self.add_constraints(*constraints) self.wait(3)Methods
installVerify the validity of constraint parameters.
mob_updaterVisual control updater
Attributes
alwaysCall a method on a mobject every frame.
animateUsed to animate the application of any method of
self.animation_overridescolordepthThe depth of the mobject.
fill_colorIf there are multiple colors (for gradient) this returns the first one
heightThe height of the mobject.
n_points_per_curvesheen_factorstroke_colorwidthThe width of the mobject.
- _abc_impl = <_abc._abc_data object>¶
- _bezier_t_values: npt.NDArray[float]¶
- _original__init__(a_mob, b_mob, pivot_world=None, anchor_a_local=array([0., 0., 0.]), anchor_b_local=array([0., 0., 0.]), anchor_a_appearance=Dot, anchor_b_appearance=Dot, pivot_appearance=Dot, connect_line_class=<class 'manim.mobject.geometry.line.Line'>, connect_line_config={'color': ManimColor('#F7D96F'), 'stroke_width': 2}, **kwargs)¶
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
a_mob (Mobject)
b_mob (Mobject)
pivot_world (list[float, float, float])
anchor_a_local (list[float, float, float])
anchor_b_local (list[float, float, float])
anchor_a_appearance (Mobject)
anchor_b_appearance (Mobject)
pivot_appearance (Mobject)
connect_line_class (Line | None)
connect_line_config (dict)
- animation_overrides = {}¶
- background_image: Image | str | None¶
- background_stroke_color: ManimColor¶
- background_stroke_opacity: float¶
- background_stroke_width: float¶
- cap_style: CapStyleType¶
- close_new_points: bool¶
- constraint: PivotJoint | None¶
- joint_type: LineJointType¶
- make_smooth_after_applying_functions: bool¶
- n_points_per_cubic_curve: int¶
- pre_function_handle_to_anchor_scale_factor: float¶
- shade_in_3d: bool¶
- submobjects: list[VMobject]¶
- tolerance_for_point_equality: float¶
- Parameters:
a_mob (Mobject)
b_mob (Mobject)
pivot_world (list[float, float, float])
anchor_a_local (list[float, float, float])
anchor_b_local (list[float, float, float])
anchor_a_appearance (Mobject)
anchor_b_appearance (Mobject)
pivot_appearance (Mobject)
connect_line_class (Line | None)
connect_line_config (dict)