2D collision simulation (Tokamak)
Blitz3D Forums/Blitz3D Programming/2D collision simulation (Tokamak)
| ||
Hello all Hope you can help me out ;) It’s allways the same problem : collision yeap ! But this time i need to add some physic collision to a top down 2D simulation. Levels are made of multiples polygons(like Soldat), what i need to simulate is gravity, elasticity, friction, centrifugal, bouce with rotation and classic linking system for chains and more. I grab on the late BlitzCoder, npoly a 2D Polygonal Collision Library. (http://www.nuloen.com/) Work’s fine but that librairy doesn’t have overlap detection and physic must be done... In the Tokamak Forum some people have sucessfully use Tokamak in a 2D platform simulation. They simply retain X and Y rotation to 0 and freeze Z object position. The official features of Tokamak talk about static triangle mesh. Does the Tokamak wrapper 0.7 Handle this ? I’m using a single surface pixel perfect display, do you know if Tokamak work fine in 2D with no Z depth objects? Others solutions with more or less physics solutions are welcome. Thanks ;) Arm |
| ||
Ok using Tokamak i've successfully achieve this : You simply have to use the Skidracer code Pixies ( http://blitzbasic.com/codearcs/codearcs.php?code=773 ). Then set every rigidBodies (or AnimatedBodies) constraint like this : TOKRB_SetRotation(rigidBody,0,0,TOKRB_GetRoll#(rigidBody)) TOKRB_SetPosition(rigidBody,TOKRB_GetX#(rigidBody),TOKRB_GetY#(rigidBody),Zpos) And Finally set your Pixies position with cameraProject: CameraProject camera,TOKRB_GetX#(rigidBody),TOKRB_GetY#(rigidBody),Zpos PositionEntity pixies,ProjectedX(),ProjectedY(),1 Hope this is a fast and acurate solution. |