Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: tvPhysics.Unload  (Read 555 times)
newborn
Customers
Community Member
*****
Posts: 2437


WWW
« on: February 24, 2008, 12:11:28 AM »

I keep getting random crashing (sometimes it does, sometime it doesn't crash) when using TVPhysics.Unload, am I the only one?

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Logged

tom_namibia
Customers
Community Member
*****
Posts: 89


WWW
« Reply #1 on: February 24, 2008, 03:17:05 AM »

yes:

http://www.truevision3d.com/forums/tv3d_sdk_65/bug_tv_physics_crash_on_second_run-t17066.0.html
Logged
SylvainTV
Administrator
Community Member
*****
Posts: 4479


WWW
« Reply #2 on: February 24, 2008, 07:05:56 AM »

Do you get crashes also with a normal unload ? (called by the engine when releasing all)
Does it happen with only 1 or 2 bodies ?

If you could reproduce this on a small example, it would be nice Smiley
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
newborn
Customers
Community Member
*****
Posts: 2437


WWW
« Reply #3 on: February 24, 2008, 12:13:33 PM »

Seems that it has something to do with the materials... If I do not load any materials, then everything unloads properly!

I'm gonna make a small sample for this
Logged

newborn
Customers
Community Member
*****
Posts: 2437


WWW
« Reply #4 on: February 24, 2008, 12:49:17 PM »

There you go: copy/paste into a new VB.Net form:

Code:

Public Class Form1
    Private _tvEngine As New MTV3D65.TVEngine
    Private _tvScene As New MTV3D65.TVScene
    Private _tvPhysics As New MTV3D65.TVPhysics
    Private _tvMesh As MTV3D65.TVMesh
    Private _tvLandscape As MTV3D65.TVLandscape

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        ' ******************************
        ' ***          INIT          ***
        ' ******************************

        ' Init engine
        With _tvEngine
            .SetDebugMode(True)
            .Init3DNoRender(Me.Handle)
        End With

        ' Init the physics
        _tvPhysics.Initialize()

        ' Create physics materials
        Dim iMatLandscape As Integer = _tvPhysics.CreateMaterialGroup("MatLandscape")
        Dim iMatMesh As Integer = _tvPhysics.CreateMaterialGroup("MatMesh")
        Dim iMatEmpty As Integer = _tvPhysics.CreateMaterialGroup("MatEmpty")

        ' Create empty body
        Dim iEmptyBody As Integer = _tvPhysics.CreateBody(100)
        _tvPhysics.SetBodyMaterialGroup(iEmptyBody, iMatEmpty)

        ' Create landscape
        _tvLandscape = _tvScene.CreateLandscape("Landscape")
        _tvLandscape.CreateEmptyTerrain(MTV3D65.CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_BEST, 1, 1, 0, 0, 0)
        Dim iLandscapeBody As Integer = _tvPhysics.CreateStaticTerrainBody(_tvLandscape)
        _tvPhysics.SetBodyMaterialGroup(iLandscapeBody, iMatLandscape)

        ' Create mesh
        _tvMesh = _tvScene.CreateMeshBuilder("Mesh")
        _tvMesh.CreateBox(1, 1, 1)
        Dim iMeshBody As Integer = _tvPhysics.CreateMeshBody(100, _tvMesh, MTV3D65.CONST_TV_PHYSICSBODY_BOUNDING.TV_BODY_BOX)
        _tvPhysics.SetBodyMaterialGroup(iMeshBody, iMatMesh)

        ' ******************************
        ' ***          QUIT          ***
        ' ******************************

        ' Unload mesh
        _tvMesh.Destroy()
        _tvMesh = Nothing

        ' Unload landscape       
        _tvLandscape.DeleteAll()
        _tvLandscape = Nothing

        ' Unload physics
        With _tvPhysics
            .DestroyBody(iLandscapeBody, False)
            .DestroyBody(iMeshBody, False)
            .DestroyBody(iEmptyBody, False)
            .Unload()
        End With
        _tvPhysics = Nothing

        ' Unload scene
        _tvScene = Nothing

        ' Unload engine
        _tvEngine.ReleaseAll()
        _tvEngine = Nothing

        ' Quit
        MsgBox("Quit normally")
        End

    End Sub

End Class

Logged

Gamecode
Customers
Community Member
*****
Posts: 367


WWW
« Reply #5 on: February 28, 2008, 09:57:12 AM »

i have same problem ... sometimes game at second , third run crash.
Logged

aiR Captains - RC aircraft project TV65
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks