Struct nphysics2d::joint::MouseConstraint [−][src]
pub struct MouseConstraint<N: Real> { /* fields omitted */ }
A spring-like constraint to be used to drag a body part with the mouse.
Methods
impl<N: Real> MouseConstraint<N>
[src]
impl<N: Real> MouseConstraint<N>
pub fn new(
b1: BodyHandle,
b2: BodyHandle,
anchor1: Point<N>,
anchor2: Point<N>,
limit: N
) -> Self
[src]
pub fn new(
b1: BodyHandle,
b2: BodyHandle,
anchor1: Point<N>,
anchor2: Point<N>,
limit: N
) -> Self
Initialize a mouse constraint between two bodies.BodyHandle
Typically, b1
will be the ground and the anchor the position of the mouse.
Both anchors are expressed in the local coordinate frames of the corresponding body parts.
pub fn set_anchor_1(&mut self, anchor1: Point<N>)
[src]
pub fn set_anchor_1(&mut self, anchor1: Point<N>)
Change the first anchor, expressed in the local space of the first body part.
pub fn set_anchor_2(&mut self, anchor2: Point<N>)
[src]
pub fn set_anchor_2(&mut self, anchor2: Point<N>)
Change the first anchor, expressed in the local space of the second body part.
Trait Implementations
impl<N: Real> JointConstraint<N> for MouseConstraint<N>
[src]
impl<N: Real> JointConstraint<N> for MouseConstraint<N>
fn num_velocity_constraints(&self) -> usize
[src]
fn num_velocity_constraints(&self) -> usize
The maximum number of velocity constraints generated by this joint.
fn anchors(&self) -> (BodyHandle, BodyHandle)
[src]
fn anchors(&self) -> (BodyHandle, BodyHandle)
The two body parts affected by this joint.
fn velocity_constraints(
&mut self,
params: &IntegrationParameters<N>,
bodies: &BodySet<N>,
ext_vels: &DVector<N>,
ground_j_id: &mut usize,
j_id: &mut usize,
jacobians: &mut [N],
constraints: &mut ConstraintSet<N>
)
[src]
fn velocity_constraints(
&mut self,
params: &IntegrationParameters<N>,
bodies: &BodySet<N>,
ext_vels: &DVector<N>,
ground_j_id: &mut usize,
j_id: &mut usize,
jacobians: &mut [N],
constraints: &mut ConstraintSet<N>
)
Initialize and retrieve all the constraints appied to the bodies attached to this joint.
fn cache_impulses(&mut self, _: &ConstraintSet<N>)
[src]
fn cache_impulses(&mut self, _: &ConstraintSet<N>)
Called after velocity constraint resolution, allows the joint to keep a cache of impulses generated for each constraint.
fn is_active(&self, bodies: &BodySet<N>) -> bool
[src]
fn is_active(&self, bodies: &BodySet<N>) -> bool
Return true
if the constraint is active. Read more
impl<N: Real> NonlinearConstraintGenerator<N> for MouseConstraint<N>
[src]
impl<N: Real> NonlinearConstraintGenerator<N> for MouseConstraint<N>
fn num_position_constraints(&self, _: &BodySet<N>) -> usize
[src]
fn num_position_constraints(&self, _: &BodySet<N>) -> usize
Maximum of non-linear position constraint this generater needs to output.
fn position_constraint(
&self,
_: &IntegrationParameters<N>,
_: usize,
_: &mut BodySet<N>,
_: &mut [N]
) -> Option<GenericNonlinearConstraint<N>>
[src]
fn position_constraint(
&self,
_: &IntegrationParameters<N>,
_: usize,
_: &mut BodySet<N>,
_: &mut [N]
) -> Option<GenericNonlinearConstraint<N>>
Generate the i
-th position constraint of this generator.
Auto Trait Implementations
impl<N> Send for MouseConstraint<N>
impl<N> Send for MouseConstraint<N>
impl<N> Sync for MouseConstraint<N>
impl<N> Sync for MouseConstraint<N>