Okay. I'm making a breakout game in blitz3d, it's a standard top down one, meaning that the Z-axis has no bearing on ball physics. I posted in the beginner forums and was told to use Normals for the physics to check for the angle and such when rebounding off a surface. It's just I have no clue how this works and looking through the tutorials included with blitz3d and one of the sample programs, but I haven't been able to recreate it. Heres the code that I have so far.
this gives me a memory allocation error. Egh. I've been messing with it for about two hours now and no dice. Also I was wondering if anyone knows of a post or link that explains normal collision detecting in detail.
Graphics3D 640,480,16,1 font=LoadFont("Arial",32,True) SetFont font SetBuffer BackBuffer() blurtex=CreateTexture(0,0,0) camera=CreateCamera() CameraClsMode camera,0,1 sprite=CreateSprite(camera) MoveEntity sprite,0,0,640 ScaleSprite sprite,640,640 EntityOrder sprite,-1 ;EntityTexture sprite,blurtex EntityAlpha sprite,0.75 EntityBlend sprite,3 Const CUBE_COL=1 Const SPHERE_COL=2 ;create ball Global ball=CreateSphere(12) ScaleEntity ball,3,3,3 EntityColor ball,100,100,255 EntityShininess ball,.2 Global balldirection = 0 ;create paddle Global p1=CreateCube() ScaleEntity p1,8,2,2 EntityColor p1,50,60,20 ;setup Collisions table EntityType ball,SPHERE_COL EntityType p1, CUBE_COL Collisions ball,p1,2,2 ground=CreateSphere(32) EntityColor ground,0,0,0 EntityType p1,2 While Not KeyHit(1) If count=3 CameraViewport camera,0,0,50,50 RenderWorld CopyRect 0,0,256,256,0,0,BackBuffer(),TextureBuffer(blurtex) CameraViewport camera,0,0,GraphicsWidth(),GraphicsHeight() count=0 EndIf count=count+1 MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 PositionEntity camera,0,100,1 RotateEntity camera,80,0,0 If x1#<-180 Then x1#=-180 If x1#>180 Then x1#=180 PositionEntity camera,0,0,200 RotateEntity camera,178,0,0 PositionEntity p1,x1#,122,0 MoveEntity ball,.5,.5,0 If EntityCollided(ball,p1) Then AlignToVector ball, CollisionNX (p1, 1), CollisionNY (p1, 1),CollisionNZ(p1,1), 3 EndIf UpdateWorld RenderWorld Color 0,0,0 Flip x1#=x1#-MouseXSpeed() Wend End
this gives me a memory allocation error. Egh. I've been messing with it for about two hours now and no dice. Also I was wondering if anyone knows of a post or link that explains normal collision detecting in detail.