After getting recent Blitz3D Update, retried the Collisions Example in the manual, but the collisions didn't work as expected (see ***** box in code). Finally discovered a fix that seems to work. Anyone have a better way to do this? Is this really a bug or am I doing something wrong?
(This is my first actual post; if I'm doing something the wrong way or in the wrong place, please let me know.)
FYI, last night, before Update from 1.64 (I know, a little procrastination going on for several months...."If it ain't broke, don't fix it...."), the example worked for me. So, wondering what changed. BTW, the reason for the indepth Collision study was to see if possible to use Sprites in Collisions with 3D. Apparently, it works okay for ellipsoid-to-sphere and ellipsoid-to-box but not ellipsoid-to-polygon. Anyone know if it's safe to use Sprites in Collisions?
My revised example actually shows the semi-transparent EntityRadius/EntityBox areas, so in any case it's an okay way to really kind of visualize how these Collisions work. I think I kind of "get it" now?! Glitch-solving can be quite educational, but it sure does take a lot of time and lost sleep!!!
Does anybody know of a better way to get the example to work without the ClearCollisions command (and, of course, the resetting of all the desired Collisions)?
Thanks :-)
(This is my first actual post; if I'm doing something the wrong way or in the wrong place, please let me know.)
; Collisions Example - modified from Blitz3D Manual ; ------------------------------------------------- Graphics3D 640,480 SetBuffer BackBuffer() ; Set collision type values type_ground=1 type_character=2 type_scenery=3 camera=CreateCamera() RotateEntity camera,45,0,0 PositionEntity camera,0,15,-10 light=CreateLight() RotateEntity light,45,0,0 ; Create sphere 'character' sphere=CreateSphere( 32 ) EntityColor sphere,0,0,255 EntityRadius sphere,1 EntityType sphere,type_character PositionEntity sphere,0,7,-4;0,7,0 ; Create cube 'scenery' cube=CreateCube() ScaleEntity cube,1,1,1;2,2,2 EntityColor cube,255,255,255;0,0,255 EntityRadius cube,2 EntityBox cube,-2,-2,-2,4,4,4 EntityType cube,type_scenery PositionEntity cube,4,7,-4 ; Create visual of EntityRadius cubeRadiusCollisionZone=CreateSphere(32) EntityColor cubeRadiusCollisionZone, 255,0,0 PositionEntity cubeRadiusCollisionZone, 4,7,-4 ; same as cube ScaleEntity cubeRadiusCollisionZone, 2,2,2 EntityAlpha cubeRadiusCollisionZone, 0.5 ; Create visual of EntityBox cubeBoxCollisionZone=CreateCube() EntityColor cubeBoxCollisionZone, 0,255,0 PositionEntity cubeBoxCollisionZone, 4,7,-4 ; same a cube ScaleEntity cubeBoxCollisionZone, 2,2,2 EntityAlpha cubeBoxCollisionZone, 0.2 ; Set collision method and response values method=2 response=2 method_info$="ellipsoid-to-polygon" While Not KeyDown( 1 ) x#=0 :y#=0 : z#=0 If KeyDown( 203 )=True Then x#=-0.1 If KeyDown( 205 )=True Then x#=0.1 If KeyDown( 208 )=True Then z#=-0.1 If KeyDown( 200 )=True Then z#=0.1 MoveEntity sphere,x#,y#,z# MoveEntity sphere,0,0,0; took out gravity when took out ground;-0.02,0 ; gravity ; Change collision method If KeyHit( 50 )=True Then method=method+1 If method=5 Then method=1 If method=1 Then method_info$="ellipsoid-to-sphere" If method=2 Then method_info$="ellipsoid-to-polygon" If method=3 Then method_info$="ellipsoid-to-box" If method=4 Then method_info$="invalid type; no collision" EndIf ;************************************************************************ ; If ClearCollisions is commented out (line doesn't exist in the Manual example), ; the collision is always defined by the "method=" line before the While..Wend loop begins ; (Tested with Blitz3D w/Updates 1.85 - 1.98 (both Fullscreen and Windowed) IDE and .exe) ; Of course, if you had declared other Collisions, they get cleared here also! ; so you would need to enable them again if you still want them active (eg-Collision w/ground) ; Me thinks there might be a better way?? ClearCollisions ;************************************************************************ ; Enable collisions between type_character and type_scenery Collisions type_character, type_scenery, method, response ; Perform collision checking UpdateWorld RenderWorld Text 0,0,"Use cursor keys to move sphere" Text 0,20,"Press M to change collision Method (currently: "+method_info$+")" Text 0,60,"Collisions type_character,type_scenery,"+method+","+response Flip Wend End
FYI, last night, before Update from 1.64 (I know, a little procrastination going on for several months...."If it ain't broke, don't fix it...."), the example worked for me. So, wondering what changed. BTW, the reason for the indepth Collision study was to see if possible to use Sprites in Collisions with 3D. Apparently, it works okay for ellipsoid-to-sphere and ellipsoid-to-box but not ellipsoid-to-polygon. Anyone know if it's safe to use Sprites in Collisions?
My revised example actually shows the semi-transparent EntityRadius/EntityBox areas, so in any case it's an okay way to really kind of visualize how these Collisions work. I think I kind of "get it" now?! Glitch-solving can be quite educational, but it sure does take a lot of time and lost sleep!!!
Does anybody know of a better way to get the example to work without the ClearCollisions command (and, of course, the resetting of all the desired Collisions)?
Thanks :-)