Page 1 of 1

3D Assertion failed

Posted: Fri Sep 26, 2008 12:16 am
by Comtois
I get this message
; ---------------------------
; Microsoft Visual C++ Runtime Library
; ---------------------------
; Assertion failed!
;
; Program: ...
; File: y:\ogremain\include\OgreAxisAlignedBox.h
; Line: 246
;
; Expression: (min.x <= max.x && min.y <= max.y && min.z <= max.z) && "The minimum corner of the box must be less than or equal to maximum corner"
;
; For information on how your program can cause an assertion
; failure, see the Visual C++ documentation on asserts
;
; (Press Retry To Debug the application - JIT must be enabled)
; ---------------------------
; Abandonner Recommencer Ignorer
; ---------------------------
With this code , use cursor to move entity, and it crash.

[EDIT] code changed

Code: Select all

#Deg2Rad = #PI/180
#Rad2Deg = 180/#PI
 
IncludeFile "Screen3DRequester.pb"

If InitEngine3D()

  InitSprite()
  InitKeyboard()
  InitMouse()
 
  Add3DArchive("Data\"          , #PB_3DArchive_FileSystem)
  Add3DArchive("Cube\", #PB_3DArchive_FileSystem)
 
  If Screen3DRequester()
 
    ;-Entité A
    LoadMesh(0,"Cube.mesh")
    CreateMaterial(0,LoadTexture(0,"background.png"))
    CreateEntity(0,MeshID(0), MaterialID(0))
         
    ;-Camera
    CreateCamera(0, 0, 0, 100, 100)
    CameraLocate(0, 0, 1400, 250)
    CameraLookAt(0,EntityX(0),EntityY(0),EntityZ(0))
 
    Define AngleY.f, LookAt.f
    LookAt=1.0
    Repeat
      ExamineKeyboard()
      AngleY-ACos(LookAt)*#Rad2Deg 
      Debug angley
      Debug "******"
      RotateEntity(0,0,angleY,0)
      LookAt+00000011920929
      RenderWorld()
      FlipBuffers()
    Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
  EndIf
   
Else
  MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf

End

Posted: Fri Sep 26, 2008 8:48 am
by Comtois
in the previous code , i haved a dot product (to get the cosinus between 2 vectors).
But sometime result of the dot product was 1.00000011920929, so
AngleY-ACos(LookAt)*#Rad2Deg
give AngleY =-1.#IND. And RotateEntity() or RotateNode() don't like this angle :)

Ok my bad, i have to clamp the result of my dot product.