PPhys2D Home
A Phys2D adaptation for Processing.
  • information
  • reference
  • examples

Reference

  • Body Classes
    • PPBox
    • PPCircle
    • PPConvexPoly
    • PPLine
    • PPPoly
  • Body Functions
    • (PPBox)getHeight()
    • (PPBox)getWidth()
    • (PPBox)setSize()
    • (PPCircle)getSize()
    • (PPCircle)setSize()
    • addExcludedBody()
    • addForce()
    • adjustAngularVelocity()
    • adjustVelocity()
    • applyMatrix()
    • attachImage()
    • dettachImage()
    • getAngularVelocity()
    • getImageAlpha()
    • getRotation()
    • getVelocityX()
    • getVelocityY()
    • getX()
    • getY()
    • isResting()
    • isStatic()
    • isTouchingBody()
    • resetForces()
    • setAngularVelocity()
    • setDamping()
    • setDrawable()
    • setFillColor()
    • setFriction()
    • setGravityEffected()
    • setImageAlpha()
    • setMass()
    • setPosition()
    • setRestitution()
    • setRotatable()
    • setRotation()
    • setRotDamping()
    • setStaticBody()
    • setStrokeColor()
    • setStrokeWidth()
    • setVelocity()
  • World Classes
    • PPWorld
  • World Fucntions
    • add()
    • clear()
    • draw()
    • remove()
    • setDamping()
    • setEdges()
    • setEdgesFriction()
    • setEdgesRestitution()
    • setGravity()
    • step()

setFriction()

Description

Set the friction of a body. A higher friction means that touching bodies will loose energy, and will result in a "sticky" effect. May be very useful to create ground objects in a platform game for exemple.

Exemples

PPBox myBox = new PPBox(20, 30);
myBox.setFriction(1);
world.add(myBox);

Syntax

myBody.setFriction(friction);

Parameters

friction ->

float : the friction intensity of the body (higher mean more energy retains).

Jean-Maxime Couillard - jm.couillard@globetrotter.net - Website bulit using CodeIgnitier PHP Engine with valid XHTML 1.0 Strict