hi guys developing application in cocoas2d using box 2d frame work unfortunately
i'm not able restrict gray ball in half screen area of image shown here want ball not go opposite part of screen
i have used b2mousejoint move ball around screen
b2prismaticjointdef restrict on particular axis but
want restrict on particular rect area of screen
you create custom distance joint restrict global axes of ball. hard if never write own physics engine.
there 2 easier ways implement want.
- create 4 static "border" boxes around area ball must stay. place ball , boxes 1 collision group.
however, response of "border" boxes not instant. therefore, ball @ high speed "sink" boxes, popped out.
- you can correct position , reset speed of ball manually in code when crosses bounds of desired area. may lead unstable physics simulation.
Comments
Post a Comment