Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: This isn't fixed yet >:/  (Read 2600 times)
SSFAN
Customers
Community Member
*****
Posts: 37


« on: November 19, 2003, 11:18:02 AM »

I use C++ for TV3D programming and had trouble to call this function

Code:

ITVCollisionResult CollisionResult;

CollisionResult = CreateTVCollisionResult();
...
...

if(CollisionResult->IsCollision())
{
   // do something
}


I expected this wll be fixed but it still crashes when I call this function.

Without this function, I can't progress my project anymore.

should I wait for 6.5?  :roll:  :roll:
Logged
SylvainTV
Administrator
Community Member
*****
Posts: 4479


WWW
« Reply #1 on: November 19, 2003, 11:29:49 AM »

Logically you never should create this TVCollisionResult class.
The class is returned by MousePick function, and is created inside the MousePick function.
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 !
Quarantine
Community Member
*
Posts: 167


« Reply #2 on: November 19, 2003, 12:57:37 PM »

I get the same thing with scene.advancedcollision.(EDIT: I didnt see he said it crashes, which mine doesn't, but hey Smiley ) The TV_COLLISIONRESULT I pass it has all the information except for TV_COLLISIONRESULT.hascollided ALWAYS returns false.

Example...

Code:

Scene.AdvancedCollision(OldPlayerPosition, NewPlayerPosition,CollisionResult, 0, TV_TESTTYPE_ACCURATETESTING, True)


Will always return FALSE, even when it has actually collided. If I change it to this...

Code:

CollisionResult.hascollided = Scene.AdvancedCollision(OldPlayerPosition, NewPlayerPosition,CollisionResult, 0, TV_TESTTYPE_ACCURATETESTING, True)


Then of course everything works as expected(with my code).

I think your just not filling the .hascollided with true or false Smiley
Logged

SSFAN
Customers
Community Member
*****
Posts: 37


« Reply #3 on: November 19, 2003, 06:21:25 PM »

Quote from: "SylvainTV"
Logically you never should create this TVCollisionResult class.
The class is returned by MousePick function, and is created inside the MousePick function.


I called Scene->MousePick function before check collision but it still crashes.

can you please see my code and point me what's wrong?

Code:


#include "Header.h"

// Declare TrueVision
ITVEngine          TV;
ITVGlobals         Globals;
ITVInputEngine     Input;
ITVScene           Scene;
ITVLandscape       Land;
ITVTextureFactory  TexFactory;
ITVCollisionResult CollisionResult;
ITVScreen2DText    Text;


void InitializeEngine(HWND hWnd)
{
ShowCursor(false);

// Create Everything
TV = CreateTVEngine();
Globals = CreateTVGlobals();
Input = CreateTVInputEngine();
Scene = CreateTVScene();
Land = CreateTVLandscape();
TexFactory = CreateTVTextureFactory();
CollisionResult = CreateTVCollisionResult();
Text = CreateTVScreen2DText();


// Initialize
TV->Init3DWindowedMode((long)hWnd,tvtrue); // windowed mode, support TnL
TV->put_DisplayFPS(tvfalse);               // don't display fps
TV->SetSearchDirectory(".");               // set current directory

Scene->SetSceneBackGround(0,0,1);          // clear background with blue
Scene->LoadCursor("..\\media\\pointer.bmp",TV_COLORKEY_BLACK,32,16); // load in-game cursor
Scene->SetCamera(0,50,550,150,100,550);

Land->GenerateHugeTerrain("..\\media\\heightmap.jpg",TV_PRECISION_LOW,8,8,0,0,tvtrue); // generate landscape
TexFactory->LoadTexture("..\\media\\sand.jpg","tex_sand",-1,-1,TV_COLORKEY_NO,tvtrue,tvtrue); // load landscape texture
Land->SetTexture(Globals->GetTex("tex_sand"),-1); // set landscape texture

long font = Text->TextureFont_Create("def_font","Arial",16,tvtrue,tvfalse,tvfalse,tvfalse); // create Arial font
}


void ShutdownEngine()
{
// Release All
Text->Release();
CollisionResult->Release();
TexFactory->Release();
Land->Release();
Scene->Release();
Input->Release();
Globals->Release();
TV->Release();

Text = NULL;
CollisionResult = NULL;
TexFactory = NULL;
Land = NULL;
Scene = NULL;
Input = NULL;
Globals = NULL;
TV = NULL;
}


void RenderScenes()
{
if(Input->IsKeyPressed(TV_KEY_ESCAPE)) // check if user press escape key
PostQuitMessage(0);                // then quit the app

TV->Clear(tvfalse);                    // clear backbuffer (not z-buffer only)

long  mX,mY;
short button;

Input->GetAbsMouseState(&mX,&mY,&button,&button,&button); // get mouse state

CollisionResult = Scene->MousePicking(mX,mY,TV_COLLIDE_LANDSCAPE,TV_TESTTYPE_ACCURATETESTING);

if(CollisionResult->IsCollision()) // BUG !!!!!!!!!!!!!!!!!!!!!!!!!!!
{
char buff[256];
sprintf(buff,"X : %.2f Y : %.2f Z : %.2f",CollisionResult->GetImpactPoint().x,CollisionResult->GetImpactPoint().y,CollisionResult->GetImpactPoint().z);
Text->TextureFont_DrawText(buff,5,5,RGBA(1,1,1,1),"");
}

Land->Render(tvtrue,tvtrue);           // render landscape

TV->RenderToScreen();                  // render scene
}
Logged
covalciucvals
Community Member
*
Posts: 1


« Reply #4 on: December 21, 2004, 03:44:26 AM »

When this bug will be solved ? :oops:

I compiled the code that you write and the application do nothing. If I use

TrueVision3D::_TVCollisionResultPtr pCollisionResult;

then finally it works.
Logged
KamiGazz
Community Member
*
Posts: 86


« Reply #5 on: December 29, 2006, 02:34:13 AM »

I know this issue is quite old but I'm seeking a some infos about that.   The previously mentionned solution did fixed my proplem too with the .isCollision() method   but now my application crashes when I close my window.

 void _Release() throw()
    {
        if (m_pInterface != NULL) {
            m_pInterface->Release();
        }
    }

  in comip.h is where my application breaks.


Any help would be appreciated.
Regards
Logged
Pages: [1]
  Print  
 
Jump to:  

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