hAPI Fisica  0.1
The hAPI Fisica physics engine expands Richard Marxer's fisica for Processing. The engine wraps the jbox2d physics engine for use with the Haply Development kit and the Hapkit.
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
FMouseJoint Class Reference
Inheritance diagram for FMouseJoint:
FJoint FDrawable

Public Member Functions

 FMouseJoint (FBody body, float x, float y)
 
void setDamping (float damping)
 
void setFrequency (float frequency)
 
void setTarget (float x, float y)
 
float getTargetX ()
 
float getTargetY ()
 
void setGrabbedBodyAndTarget (FBody body, float x, float y)
 
void releaseGrabbedBody ()
 
FBody getGrabbedBody ()
 
void setAnchor (float x, float y)
 
float getAnchorX ()
 
float getAnchorY ()
 
void draw (PGraphics applet)
 
void drawDebug (PGraphics applet)
 
- Public Member Functions inherited from FJoint
Joint getBox2dJoint ()
 
void addToWorld (FWorld world)
 
void removeFromWorld ()
 
FBody getBody1 ()
 
FBody getBody2 ()
 
void setCollideConnected (boolean value)
 
float getReactionForceX ()
 
float getReactionForceY ()
 
float getReactionTorque ()
 
- Public Member Functions inherited from FDrawable
void draw (PGraphics graphics)
 
void draw (PApplet applet)
 
void drawDebug (PGraphics graphics)
 
void drawDebug (PApplet applet)
 
void attachImage (PImage img)
 
void dettachImage ()
 
float getImageAlpha ()
 
void setImageAlpha (float alpha)
 
void setDrawable (boolean drawable)
 
boolean isDrawable ()
 
int getFillColor ()
 
void setFillColor (int col)
 
void setNoFill ()
 
void setFill (float g)
 
void setFill (float g, float a)
 
void setFill (float r, float g, float b)
 
void setFill (float r, float g, float b, float a)
 
void setStrokeColor (int col)
 
void setNoStroke ()
 
void setStroke (float g)
 
void setStroke (float g, float a)
 
void setStroke (float r, float g, float b)
 
void setStroke (float r, float g, float b, float a)
 
void setStrokeWeight (float weight)
 

Protected Member Functions

JointDef getJointDef (FWorld world)
 
- Protected Member Functions inherited from FJoint
void processJoint (World world, JointDef jd)
 
JointDef getJointDef (FWorld world)
 
void preDraw (PGraphics applet)
 
void postDraw (PGraphics applet)
 
void preDrawDebug (PGraphics applet)
 
void postDrawDebug (PGraphics applet)
 
- Protected Member Functions inherited from FDrawable
void updateStyle (FDrawable other)
 
void appletStroke (PGraphics applet, int argb)
 
void appletFill (PGraphics applet, int argb)
 
void appletFillStroke (PGraphics applet)
 
void drawImage (PGraphics applet)
 

Protected Attributes

FBody m_fbody
 
Vec2 m_anchor
 
Vec2 m_target
 
float m_damping = 0.9f
 
float m_frequency = 20.0f
 
- Protected Attributes inherited from FJoint
Joint m_joint
 
FWorld m_world
 
boolean m_collideConnected = true
 
- Protected Attributes inherited from FDrawable
boolean m_drawable = true
 
boolean m_fill = true
 
int m_fillColor = 0xFFFFFFFF
 
boolean m_stroke = true
 
int m_strokeColor = 0xFF000000
 
float m_strokeWeight = 1.0f
 
PImage m_image = null
 
float m_imageAlpha = 255.0f
 
PImage m_mask = null
 

Detailed Description

Represents a mouse joint that tries to keep a body at a constant distance from the target. This joint is similar to connecting a spring from from the body to a target whose position can be changed programatically using setTarget.

Constructor & Destructor Documentation

◆ FMouseJoint()

FMouseJoint.FMouseJoint ( FBody  body,
float  x,
float  y 
)

Construct a mouse joint between a body and a target. The constructor automatically sets the anchors of the joint to the center of the body.

Parameters
bodythe body to be grabbed by the joint
xhorizontal coordinate of the initial target of the joint
yvertical coordinate of the initial target of the joint

Member Function Documentation

◆ getAnchorX()

float FMouseJoint.getAnchorX ( )

Get the horizontal coordinate of the anchor point on the body. This position is given relative to the center of the body.

Returns
the horizontal coordinate of the anchor relative to the center of the first body

◆ getAnchorY()

float FMouseJoint.getAnchorY ( )

Get the vertical coordinate of the anchor point on the body. This position is given relative to the center of the body.

Returns
the vertical coordinate of the anchor relative to the center of the first body

◆ getGrabbedBody()

FBody FMouseJoint.getGrabbedBody ( )

Returns the body grabbed by this joint.

Returns
the body grabbed by this joint

◆ getTargetX()

float FMouseJoint.getTargetX ( )

Returns the horizontal target position of the joint.

Returns
horizontal coordinate of the target of the joint

◆ getTargetY()

float FMouseJoint.getTargetY ( )

Returns the vertical target position of the joint.

Returns
vertical coordinate of the target of the joint

◆ releaseGrabbedBody()

void FMouseJoint.releaseGrabbedBody ( )

Releases the body grabbed by this joint.

◆ setAnchor()

void FMouseJoint.setAnchor ( float  x,
float  y 
)

Sets the anchor position at which the joint grabs the body. The anchor point is the point used to apply forces in order to move the body.

Parameters
xthe horizontal coordinate of the anchor relative to the center of the body
ythe vertical coordinate of the anchor relative to the center of the body

◆ setDamping()

void FMouseJoint.setDamping ( float  damping)

Sets the damping of the spring used to maintain the body and the target together. This property must be set before adding the joint to the world.

Parameters
dampingthe damping of the spring

◆ setFrequency()

void FMouseJoint.setFrequency ( float  frequency)

Sets the frequency of the spring used to maintain the body and the target together. This property must be set before adding the joint to the world.

Parameters
frequencythe frequency of the spring

◆ setGrabbedBodyAndTarget()

void FMouseJoint.setGrabbedBodyAndTarget ( FBody  body,
float  x,
float  y 
)

Sets the body grabbed by this joint and the target position.

Parameters
bodythe body to be grabbed by the joint
xhorizontal coordinate of the target of the joint
yvertical coordinate of the target of the joint

◆ setTarget()

void FMouseJoint.setTarget ( float  x,
float  y 
)

Sets the target position of the joint. By setting this property everytime the mouse is used we are able to make the body of this joint follow mouse.

Parameters
xhorizontal coordinate of the target of the joint
yvertical coordinate of the target of the joint

The documentation for this class was generated from the following file: