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()

setPosition()

Description

Set the position of a body without collision restriction. Using this function unproperly may cause collision detection problems and unwanted effects. For a smooth move, you should use addForce() instead.

Exemples

PPBox myBox = new PPBox(100, 200);
myBox.setPosition(50, 150);
world.add(myBox);

Syntax

myBody.setPosition(x, y);

Parameters

x ->

int : x position of the body.

y ->

int : y position of the body.

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