Banks and Tokamak
Blitz3D Forums/Blitz3D Programming/Banks and Tokamak
| ||
I have started using Tokamak. Yippy! But it seams to use banks alot, something I have not got into because createbank() is under-documented. So If anyone could point me to some tutorials or just explain banks better for me you have my undying gratatude. Specificly how to use them with Tokamak. For instance I found a truck rally sample by Sweeny and it uses banks to set the collision info for the terrain mesh. TOKSIM_CreateSimulator(0,-9.0,0) ;Sets the parameters for a material. Materials can be used for different things including triangles, ;rigid bodies, And animated bodies. (And once supported, particles) TOKSIM_SetMaterial 0,0,.1 ;(Index%,Friction#,Restitution#) ;Sets collisions ColBank=CreateBank(104*10) TOKSIM_SetCInfoBank ColBank TOKSIM_SetCollisionResponse -1,1,3 ; Impulse & Feedback originaly (-1,1,3) TOKSIM_SetCollisionResponse -1,2,0 ; No Impulse Or Feedback -1,2,0 tex = LoadTexture("track.bmp") Terrain = LoadMesh("track.3ds") ScaleMesh Terrain,30.0,30.0,30.0 RotateMesh Terrain,-90,0,0 EntityTexture terrain,tex MakeTokCollider(Terrain) So in this line, ColBank=CreateBank(104*10), how did he know how to set 104*10? |
| ||
104 is the number of bytes per collision, 10 is the actual maximum or the guessed max number of collisions. http://playerfactory.proboards25.com/index.cgi?board=tokamak2&action=display&num=1077666832 2nd post |
| ||
Sorry for being dence, but still, how would I know which of those to use. In the code above he is using it for a terrain. So what would I use for say a basic cube? This one? Function TOKCOL_bodyA(bank,index) Return PeekInt(bank,index*104) End Function And then for a sphere, I would move up the list or am I just totaly off base? I guess what I am asking is how do I use those functions and wich functions to use? I have another question. While I have your attention, I am working on my first experiment with tokamak. I am just trying to make a flatend cylinder that scoots along a terrain, that will react to the terrain. I am using the terrain and its collision code from the Truck Rally again till I can write my own. The problem I am having is making an accurate representation of the collision cylinder but there is no way I can be sure if it is correct. So do I have this part right? diameter#=1.5 height#=diameter#-1.25 x_pos#=0 y_pos#=5 z_pos#=10 Global player_mesh=CreateCylinder(32,True) ScaleEntity player_mesh,diameter#,height#,diameter# PositionEntity player_mesh,x_pos#,y_pos#,z_pos# EntityColor player_mesh,255,0,0 Global player_RB=TOKRB_Create() TOKRB_AddCylinder(player_RB,diameter#,height#) ;TOKRB_AddCylinder(RigidBody%,Diameter#,Height#) TOKRB_SetPosition player_RB,0,5,10 veiwcoll=CreateCylinder(32,True) EntityAlpha veiwcoll,.25 ScaleEntity veiwcoll,diameter#/2,height#,diameter#/2 PositionEntity veiwcoll,TOKRB_GetX(player_RB),TOKRB_GetY(player_RB),TOKRB_GetZ(player_RB) Thank you Very much for your time. I will be happy to donate this and many more examples when its done. |