[SOLVED]Low-level collision problems

F1rst

15-07-2006 17:57:47

Hello!
I'm trying to use OgreNewt for low-level collision detection.
If I use box vs. box(or other simple primitives)
my program crashes, if I use mesh vs. mesh I ALWAYS
get 0 contact points even if they collide.
Where am I wrong,answer please?
Here is my code:

#include "ExampleApplication.h"
#include "OgreNewt.h"

OgreNewt::Collision *Ogrecol,*Robotcol;

class TutorialFrameListener : public ExampleFrameListener
{
public:
TutorialFrameListener( RenderWindow* win, Camera* cam, SceneManager *sceneMgr ,OgreNewt::World* W)
: ExampleFrameListener(win, cam, false, false)
{
mWorld=W;
mSceneMgr=sceneMgr;
Ogrenode=mSceneMgr->getSceneNode("Ogrenode");
Robotnode=mSceneMgr->getSceneNode("Robotnode");
Camnode=mSceneMgr->getSceneNode("Camnode");
CamRnode=mSceneMgr->getSceneNode("CamRnode");
mCamera=cam;

mRotate=0.13;
LogManager::getSingleton().logMessage("#TutFrameconstructor#");
}

bool frameStarted(const FrameEvent &evt)
{
tv=Vector3::ZERO;
cv=Vector3::ZERO;
mInputDevice->capture();
if (mInputDevice->isKeyDown(KC_W))
tv.z+=-1;
if (mInputDevice->isKeyDown(KC_S))
tv.z+=1;
if (mInputDevice->isKeyDown(KC_A))
tv.x+=-1;
if (mInputDevice->isKeyDown(KC_D))
tv.x+=1;
tv*=1;
Ogrenode->translate(tv);
////////////////
if (mInputDevice->isKeyDown(KC_UP))
cv.z+=-1;
if (mInputDevice->isKeyDown(KC_DOWN))
cv.z+=1;
if (mInputDevice->isKeyDown(KC_LEFT))
cv.x+=-1;
if (mInputDevice->isKeyDown(KC_RIGHT))
cv.x+=1;
cv*=250;

Camnode->yaw( Degree(-mRotate * mInputDevice->getMouseRelativeX()) );
CamRnode->pitch( Degree(-mRotate * mInputDevice->getMouseRelativeY()) );
Camnode->translate(mCamera->getWorldOrientation()*cv*evt.timeSinceLastFrame);
///////////////////////

text="";
LogManager::getSingleton().logMessage("#Before#");
/*Here is crash*/ Num=OgreNewt::CollisionTools::CollisionCollide(mWorld,10,
Ogrecol,Ogrenode->getOrientation(),Ogrenode->getPosition(),
Robotcol,Robotnode->getOrientation(),Robotnode->getPosition(),retc,retn,retp);
LogManager::getSingleton().logMessage("#After#");
//if (Num)
// text+="########Collide#########";

//text+=StringConverter::toString(Ogrenode->getPosition());
//text+=StringConverter::toString(Robotnode->getPosition());
text+=StringConverter::toString(Num);
mWindow->setDebugText(text);



return ! mInputDevice->isKeyDown( KC_ESCAPE );
//return ExampleFrameListener::frameStarted( evt );
}
protected:
int Num;
Ogre::String text;
bool mMouseDown;
Real mToggle,mRotate,mMove,Angle;
SceneManager *mSceneMgr;
SceneNode *Ogrenode,*Robotnode,*Camnode,*CamRnode;
Vector3 tv,cv;
bool b1,b2,b3,b4,b5,b6;
// Entity *Ogreent,*Robotent;
Camera* mCamera;
OgreNewt::World* mWorld;
///////////////////
Vector3 *retc,*retn;
Real *retp;
};





class TutorialApplication: public ExampleApplication
{
protected:
OgreNewt::World* mWorld;
Ogre::FrameListener* mNewtonListener;
public:
TutorialApplication()
{
mWorld = new OgreNewt::World();
mWorld->setWorldSize(Vector3(-5000,-5000,-5000),Vector3(5000,5000,5000));
}
~TutorialApplication()
{
delete mWorld;
OgreNewt::Debugger::getSingleton().deInit();
}
protected:
void createCamera(void)
{
mCamera = mSceneMgr->createCamera("mCamera");
mCamera->setNearClipDistance(5);

}

void createFrameListener(void)
{
mFrameListener = new TutorialFrameListener(mWindow, mCamera, mSceneMgr,mWorld);
mRoot->addFrameListener(mFrameListener);
mFrameListener->showDebugOverlay(true);


mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, mSceneMgr, mWorld, 240 );
mRoot->addFrameListener(mNewtonListener);
}



void createScene(void)
{
mSceneMgr->setAmbientLight( ColourValue( 1, 1, 1 ) );
mSceneMgr->setSkyBox(true, "Examples/StormySkyBox");

SceneNode* Ogrenode=mSceneMgr->getRootSceneNode()->createChildSceneNode("Ogrenode");
Entity *Ogreent=mSceneMgr->createEntity("Ogreent","Ogrehead.mesh");
Ogrenode->attachObject(Ogreent);

SceneNode* Robotnode=mSceneMgr->getRootSceneNode()->createChildSceneNode("Robotnode");
Entity *Robotent=mSceneMgr->createEntity("Robotent","Robot.mesh");
Robotnode->attachObject(Robotent);
SceneNode *Camnode=mSceneMgr->getRootSceneNode()->createChildSceneNode("Camnode");
SceneNode *CamRnode=Camnode->createChildSceneNode("CamRnode");
CamRnode->attachObject(mCamera);

//Ogrecol=new OgreNewt::CollisionPrimitives::TreeCollisionSceneParser( mWorld, Ogrenode, true );
//Robotcol=new OgreNewt::CollisionPrimitives::TreeCollisionSceneParser( mWorld, Robotnode, true );

Ogrecol=new OgreNewt::CollisionPrimitives::Box( mWorld,Vector3(100,100,100));
Robotcol=new OgreNewt::CollisionPrimitives::Box( mWorld,Vector3(50,50,50));
LogManager::getSingleton().logMessage("#createScene#");
}
};
int main()
{
TutorialApplication app;
try {
app.go();
} catch( Exception& e ) {
fprintf(stderr, "An exception has occured: %s\n",
e.getFullDescription().c_str());
}
return 0;
}



And here is ogre.log

20:36:00: Creating resource group General
20:36:00: Creating resource group Internal
20:36:00: Creating resource group Autodetect
20:36:00: Registering ResourceManager for type Material
20:36:00: Registering ResourceManager for type Mesh
20:36:00: Registering ResourceManager for type Skeleton
20:36:00: MovableObjectFactory for type 'ParticleSystem' registered.
20:36:00: Loading library OgrePlatform.dll
20:36:00: OverlayElementFactory for type Panel registered.
20:36:00: OverlayElementFactory for type BorderPanel registered.
20:36:00: OverlayElementFactory for type TextArea registered.
20:36:00: Registering ResourceManager for type Font
20:36:00: ArchiveFactory for archive type FileSystem registered.
20:36:00: ArchiveFactory for archive type Zip registered.
20:36:00: DevIL version: Developer's Image Library (DevIL) 1.6.7 Nov 9 2005
20:36:00: DevIL image formats: bmp dib cut dcx dds gif hdr ico cur jpg jpe jpeg lif mdl mng jng pcx pic pix png pbm pgm pnm ppm psd pdd psp pxr sgi bw rgb rgba tga vda icb vst tif tiff wal xpm raw
20:36:00: Registering ResourceManager for type HighLevelGpuProgram
20:36:00: Registering ResourceManager for type Compositor
20:36:00: MovableObjectFactory for type 'Entity' registered.
20:36:00: MovableObjectFactory for type 'Light' registered.
20:36:00: MovableObjectFactory for type 'BillboardSet' registered.
20:36:00: MovableObjectFactory for type 'ManualObject' registered.
20:36:00: MovableObjectFactory for type 'BillboardChain' registered.
20:36:00: MovableObjectFactory for type 'RibbonTrail' registered.
20:36:00: Loading library .\RenderSystem_Direct3D9
20:36:00: D3D9 : Direct3D9 Rendering Subsystem created.
20:36:00: D3D9: Driver Detection Starts
20:36:00: D3D9: Driver Detection Ends
20:36:00: Loading library .\RenderSystem_GL
20:36:00: OpenGL Rendering Subsystem created.
20:36:01: Loading library .\Plugin_ParticleFX
20:36:01: Particle Emitter Type 'Point' registered
20:36:01: Particle Emitter Type 'Box' registered
20:36:01: Particle Emitter Type 'Ellipsoid' registered
20:36:01: Particle Emitter Type 'Cylinder' registered
20:36:01: Particle Emitter Type 'Ring' registered
20:36:01: Particle Emitter Type 'HollowEllipsoid' registered
20:36:01: Particle Affector Type 'LinearForce' registered
20:36:01: Particle Affector Type 'ColourFader' registered
20:36:01: Particle Affector Type 'ColourFader2' registered
20:36:01: Particle Affector Type 'ColourImage' registered
20:36:01: Particle Affector Type 'ColourInterpolator' registered
20:36:01: Particle Affector Type 'Scaler' registered
20:36:01: Particle Affector Type 'Rotator' registered
20:36:01: Particle Affector Type 'DirectionRandomiser' registered
20:36:01: Particle Affector Type 'DeflectorPlane' registered
20:36:01: Loading library .\Plugin_BSPSceneManager
20:36:01: Registering ResourceManager for type BspLevel
20:36:01: Loading library .\Plugin_OctreeSceneManager
20:36:01: Loading library .\Plugin_CgProgramManager
20:36:01: *-*-* OGRE Initialising
20:36:01: *-*-* Version 1.2.0 (Dagon)
20:36:01: Creating resource group Bootstrap
20:36:01: Added resource location '../../../Media/packs/OgreCore.zip' of type 'Zip' to resource group 'Bootstrap'
20:36:01: Added resource location '../../../Media' of type 'FileSystem' to resource group 'General'
20:36:01: Added resource location '../../../Media/fonts' of type 'FileSystem' to resource group 'General'
20:36:01: Added resource location '../../../Media/materials/programs' of type 'FileSystem' to resource group 'General'
20:36:01: Added resource location '../../../Media/materials/scripts' of type 'FileSystem' to resource group 'General'
20:36:01: Added resource location '../../../Media/materials/textures' of type 'FileSystem' to resource group 'General'
20:36:01: Added resource location '../../../Media/models' of type 'FileSystem' to resource group 'General'
20:36:01: Added resource location '../../../Media/overlays' of type 'FileSystem' to resource group 'General'
20:36:01: Added resource location '../../../Media/particle' of type 'FileSystem' to resource group 'General'
20:36:01: Added resource location '../../../Media/gui' of type 'FileSystem' to resource group 'General'
20:36:01: Added resource location '../../../Media/DeferredShadingMedia' of type 'FileSystem' to resource group 'General'
20:36:01: Added resource location '../../../Media/packs/cubemap.zip' of type 'Zip' to resource group 'General'
20:36:01: Added resource location '../../../Media/packs/cubemapsJS.zip' of type 'Zip' to resource group 'General'
20:36:01: Added resource location '../../../Media/packs/dragon.zip' of type 'Zip' to resource group 'General'
20:36:01: Added resource location '../../../Media/packs/fresneldemo.zip' of type 'Zip' to resource group 'General'
20:36:01: Added resource location '../../../Media/packs/ogretestmap.zip' of type 'Zip' to resource group 'General'
20:36:01: Added resource location '../../../Media/packs/skybox.zip' of type 'Zip' to resource group 'General'
20:36:01: Added resource location '../../../Media/packs/TestLevel.zip' of type 'Zip' to resource group 'General'
20:36:01: D3D9 : RenderSystem Option: Allow NVPerfHUD = No
20:36:01: D3D9 : RenderSystem Option: Anti aliasing = None
20:36:01: D3D9 : RenderSystem Option: Floating-point mode = Fastest
20:36:01: D3D9 : RenderSystem Option: Full Screen = Yes
20:36:01: D3D9 : RenderSystem Option: Rendering Device = NVIDIA RIVA TNT2 Model 64/Model 64 Pro
20:36:01: D3D9 : RenderSystem Option: VSync = No
20:36:01: D3D9 : RenderSystem Option: Video Mode = 800 x 600 @ 32-bit colour
20:36:02: *** Starting Win32GL Subsystem ***
20:36:02: GLRenderSystem::createRenderWindow "OGRE Render Window", 800x600 fullscreen miscParams: FSAA=0 colourDepth=32 vsync=false
20:36:02: Created Win32Window 'OGRE Render Window' : 800x600, 32bpp
20:36:02: GL_VERSION = 1.5.3
20:36:02: GL_VENDOR = NVIDIA Corporation
20:36:02: GL_RENDERER = RIVA TNT2/AGP/SSE
20:36:02: GL_EXTENSIONS = GL_ARB_imaging GL_ARB_multitexture GL_ARB_point_parameters GL_ARB_texture_env_add GL_ARB_texture_mirrored_repeat GL_ARB_transpose_matrix GL_ARB_vertex_buffer_object GL_ARB_window_pos GL_EXT_texture_env_add GL_EXT_abgr GL_EXT_bgra GL_EXT_compiled_vertex_array GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_multi_draw_arrays GL_EXT_packed_pixels GL_EXT_pixel_buffer_object GL_EXT_point_parameters GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_stencil_wrap GL_EXT_texture_edge_clamp GL_EXT_texture_env_combine GL_EXT_texture_lod_bias GL_EXT_texture_object GL_EXT_vertex_array GL_IBM_rasterpos_clip GL_IBM_texture_mirrored_repeat GL_KTX_buffer_region GL_NV_blend_square GL_NV_fog_distance GL_NV_light_max_exponent GL_NV_packed_depth_stencil GL_NV_texgen_reflection GL_NV_texture_env_combine4 GL_SGIS_multitexture GL_SUN_slice_accum GL_WIN_swap_hint WGL_EXT_swap_control
20:36:02: Supported WGL extensions: WGL_ARB_buffer_region WGL_ARB_extensions_string WGL_ARB_make_current_read WGL_ARB_pbuffer WGL_ARB_pixel_format WGL_EXT_extensions_string WGL_EXT_swap_control
20:36:02: ***************************
*** GL Renderer Started ***
***************************
20:36:02: Registering ResourceManager for type GpuProgram
20:36:02: GL: Using PBuffers for rendering to textures
20:36:02: RenderSystem capabilities
20:36:02: -------------------------
20:36:02: * Hardware generation of mipmaps: yes
20:36:02: * Texture blending: yes
20:36:02: * Anisotropic texture filtering: no
20:36:02: * Dot product texture operation: yes
20:36:02: * Cube mapping: yes
20:36:02: * Hardware stencil buffer: yes
20:36:02: - Stencil depth: 8
20:36:02: - Two sided stencil support: no
20:36:02: - Wrap stencil values: yes
20:36:02: * Hardware vertex / index buffers: yes
20:36:02: * Vertex programs: no
20:36:02: * Fragment programs: no
20:36:02: * Texture Compression: yes
20:36:02: - DXT: no
20:36:02: - VTC: no
20:36:02: * Scissor Rectangle: yes
20:36:02: * Hardware Occlusion Query: yes
20:36:02: * User clip planes: yes
20:36:02: * VET_UBYTE4 vertex element type: yes
20:36:02: * Infinite far plane projection: yes
20:36:02: * Hardware render-to-texture: yes
20:36:02: * Floating point textures: no
20:36:02: * Non-power-of-two textures: no
20:36:02: * Volume textures: yes
20:36:02: * Multiple Render Targets: 1
20:36:02: * Point Sprites: no
20:36:02: * Extended point parameters: yes
20:36:02: * Max Point Size: 63.375
20:36:02: Registering ResourceManager for type Texture
20:36:02: ResourceBackgroundQueue - threading disabled
20:36:02: Particle Renderer Type 'billboard' registered
20:36:02: Creating viewport on target 'OGRE Render Window', rendering from camera 'mCamera', relative dimensions L: 0.00 T: 0.00 W: 1.00 H: 1.00 ZOrder: 0
20:36:02: Viewport for camera 'mCamera', actual dimensions L: 0 T: 0 W: 800 H: 600
20:36:02: Parsing scripts for resource group Autodetect
20:36:02: Finished parsing scripts for resource group Autodetect
20:36:02: Parsing scripts for resource group Bootstrap
20:36:02: Parsing script OgreCore.material
20:36:02: Parsing script OgreProfiler.material
20:36:02: Parsing script Ogre.fontdef
20:36:02: Parsing script OgreDebugPanel.overlay
20:36:02: Texture: New_Ogre_Border_Center.png: Loading 1 faces(PF_A8B8G8R8,256x128x1) with 8 hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x128x1.
20:36:02: Texture: New_Ogre_Border.png: Loading 1 faces(PF_A8B8G8R8,256x256x1) with 8 hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x256x1.
20:36:02: Texture: New_Ogre_Border_Break.png: Loading 1 faces(PF_A8B8G8R8,32x32x1) with 5 hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1.
20:36:02: Font BlueHighwayusing texture size 512x512
20:36:02: Info: Freetype returned null for character 127 in font BlueHighway
20:36:02: Info: Freetype returned null for character 128 in font BlueHighway
20:36:02: Info: Freetype returned null for character 129 in font BlueHighway
20:36:02: Info: Freetype returned null for character 130 in font BlueHighway
20:36:02: Info: Freetype returned null for character 131 in font BlueHighway
20:36:02: Info: Freetype returned null for character 132 in font BlueHighway
20:36:02: Info: Freetype returned null for character 133 in font BlueHighway
20:36:02: Info: Freetype returned null for character 134 in font BlueHighway
20:36:02: Info: Freetype returned null for character 135 in font BlueHighway
20:36:02: Info: Freetype returned null for character 136 in font BlueHighway
20:36:02: Info: Freetype returned null for character 137 in font BlueHighway
20:36:02: Info: Freetype returned null for character 138 in font BlueHighway
20:36:02: Info: Freetype returned null for character 139 in font BlueHighway
20:36:02: Info: Freetype returned null for character 140 in font BlueHighway
20:36:02: Info: Freetype returned null for character 141 in font BlueHighway
20:36:02: Info: Freetype returned null for character 142 in font BlueHighway
20:36:02: Info: Freetype returned null for character 143 in font BlueHighway
20:36:02: Info: Freetype returned null for character 144 in font BlueHighway
20:36:02: Info: Freetype returned null for character 145 in font BlueHighway
20:36:02: Info: Freetype returned null for character 146 in font BlueHighway
20:36:02: Info: Freetype returned null for character 147 in font BlueHighway
20:36:02: Info: Freetype returned null for character 148 in font BlueHighway
20:36:02: Info: Freetype returned null for character 149 in font BlueHighway
20:36:02: Info: Freetype returned null for character 150 in font BlueHighway
20:36:02: Info: Freetype returned null for character 151 in font BlueHighway
20:36:02: Info: Freetype returned null for character 152 in font BlueHighway
20:36:02: Info: Freetype returned null for character 153 in font BlueHighway
20:36:02: Info: Freetype returned null for character 154 in font BlueHighway
20:36:02: Info: Freetype returned null for character 155 in font BlueHighway
20:36:02: Info: Freetype returned null for character 156 in font BlueHighway
20:36:02: Info: Freetype returned null for character 157 in font BlueHighway
20:36:02: Info: Freetype returned null for character 158 in font BlueHighway
20:36:02: Info: Freetype returned null for character 159 in font BlueHighway
20:36:02: Info: Freetype returned null for character 160 in font BlueHighway
20:36:02: Texture: BlueHighwayTexture: Loading 1 faces(PF_BYTE_LA,512x512x1) with hardware generated mipmaps from Image. Internal format is PF_BYTE_LA,512x512x1.
20:36:02: Texture: ogretext.png: Loading 1 faces(PF_A8B8G8R8,256x128x1) with 8 hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x128x1.
20:36:02: Parsing script OgreLoadingPanel.overlay
20:36:02: Finished parsing scripts for resource group Bootstrap
20:36:02: Parsing scripts for resource group General
20:36:02: Parsing script Examples.program
20:36:02: Parsing script StdQuad_vp.program
20:36:02: Parsing script deferred.glsl.program
20:36:02: Parsing script deferred.hlsl.program
20:36:02: Parsing script deferred_post_debug.glsl.program
20:36:02: Parsing script deferred_post_debug.hlsl.program
20:36:02: Parsing script deferred_post_minilight.glsl.program
20:36:02: Parsing script deferred_post_minilight.hlsl.program
20:36:02: Parsing script deferred_post_multipass.glsl.program
20:36:02: Parsing script deferred_post_multipass.hlsl.program
20:36:02: Parsing script deferred_post_onepass.glsl.program
20:36:02: Parsing script deferred_post_onepass.hlsl.program
20:36:02: Parsing script BlackAndWhite.material
20:36:02: Parsing script Bloom.material
20:36:02: Parsing script Bullet.material
20:36:02: Parsing script DOF.material
20:36:02: Parsing script Embossed.material
20:36:02: Parsing script Example-DynTex.material
20:36:02: Parsing script Example-Water.material
20:36:02: Parsing script Example.material
20:36:02: Parsing script Examples-Advanced.material
20:36:02: Parsing script facial.material
20:36:02: Parsing script Glass.material
20:36:02: Parsing script hdr.material
20:36:02: Parsing script HeatVision.material
20:36:02: Parsing script Hurt.material
20:36:02: Parsing script Invert.material
20:36:02: Parsing script Laplace.material
20:36:02: Parsing script MotionBlur.material
20:36:02: Parsing script my.material
20:36:02: Parsing script Ocean.material
20:36:02: Parsing script OffsetMapping.material
20:36:02: Parsing script Ogre.material
20:36:02: Parsing script OldMovie.material
20:36:02: Parsing script OldTV.material
20:36:02: Parsing script Plane01.material
20:36:03: Parsing script Posterize.material
20:36:03: Parsing script Project.material
20:36:03: Parsing script RZR-002.material
20:36:03: Parsing script SharpenEdges.material
20:36:03: Parsing script smoke.material
20:36:03: Parsing script target.material
20:36:03: Parsing script TestLevel.material
20:36:03: Parsing script Tiling.material
20:36:03: Parsing script _House.material
20:36:03: Parsing script deferred.material
20:36:03: Parsing script deferreddemo.material
20:36:03: Parsing script deferred_post_debug.material
20:36:03: Parsing script deferred_post_minilight.material
20:36:03: Parsing script deferred_post_multipass.material
20:36:03: Parsing script deferred_post_onepass.material
20:36:03: Parsing script fresnelenviron.material
20:36:03: Parsing script Examples.compositor
20:36:03: Parsing script sample.fontdef
20:36:03: Parsing script Example-Water.particle
20:36:03: Parsing script Example.particle
20:36:03: Parsing script smoke.particle
20:36:03: Parsing script Compositor.overlay
20:36:03: Parsing script DP3.overlay
20:36:03: Parsing script Example-CubeMapping.overlay
20:36:03: Parsing script Example-DynTex.overlay
20:36:03: Parsing script Example-Water.overlay
20:36:03: Parsing script gunsight.overlay
20:36:03: Texture: target.png: Loading 1 faces(PF_A8B8G8R8,23x23x1) with 5 hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1.
20:36:03: Texture: hot_target.png: Loading 1 faces(PF_A8B8G8R8,23x23x1) with 5 hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1.
20:36:03: Parsing script Shadows.overlay
20:36:03: Finished parsing scripts for resource group General
20:36:03: Parsing scripts for resource group Internal
20:36:03: Finished parsing scripts for resource group Internal
20:36:03: Texture: stormy_fr.jpg: Loading 1 faces(PF_B8G8R8,512x512x1) with 5 hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,512x512x1.
20:36:03: Texture: stormy_bk.jpg: Loading 1 faces(PF_B8G8R8,512x512x1) with 5 hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,512x512x1.
20:36:03: Texture: stormy_lf.jpg: Loading 1 faces(PF_B8G8R8,512x512x1) with 5 hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,512x512x1.
20:36:03: Texture: stormy_rt.jpg: Loading 1 faces(PF_B8G8R8,512x512x1) with 5 hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,512x512x1.
20:36:03: Texture: stormy_up.jpg: Loading 1 faces(PF_B8G8R8,512x512x1) with 5 hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,512x512x1.
20:36:04: Texture: stormy_dn.jpg: Loading 1 faces(PF_B8G8R8,512x512x1) with 5 hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,512x512x1.
20:36:04: Mesh: Loading Ogrehead.mesh.
20:36:04: Texture: WeirdEye.png: Loading 1 faces(PF_B8G8R8,256x256x1) with 8 hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,256x256x1.
20:36:04: Texture: GreenSkin.jpg: Loading 1 faces(PF_B8G8R8,256x256x1) with 8 hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,256x256x1.
20:36:04: Texture: spheremap.png: Loading 1 faces(PF_B8G8R8,256x256x1) with 8 hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,256x256x1.
20:36:04: Texture: dirt01.jpg: Loading 1 faces(PF_B8G8R8,96x96x1) with 7 hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
20:36:04: Mesh: Loading Robot.mesh.
20:36:04: Skeleton: Loading robot.skeleton
20:36:04: Texture: r2skin.jpg: Loading 1 faces(PF_B8G8R8,512x512x1) with 9 hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,512x512x1.
20:36:04: #createScene#
20:36:04: Win32Input8: DirectInput Activation Starts
20:36:04: Win32Input8: Establishing keyboard input.
20:36:04: Win32Input8: Keyboard input established.
20:36:04: Win32Input8: Initializing mouse input in immediate mode.
20:36:04: Win32Input8: Mouse input in immediate mode initialized.
20:36:04: Win32Input8: DirectInput OK.
20:36:04: #TutFrameconstructor#
20:36:04: Win32Input8: DirectInput Activation Starts
20:36:04: Win32Input8: Establishing keyboard input.
20:36:04: Win32Input8: Keyboard input established.
20:36:04: Win32Input8: Initializing mouse input in immediate mode.
20:36:04: Win32Input8: Mouse input in immediate mode initialized.
20:36:04: Win32Input8: DirectInput OK.
20:36:04: #Before#

HexiDave

15-07-2006 18:20:15

You create the collisions:
Ogrecol=new OgreNewt::CollisionPrimitives::Box( mWorld,Vector3(100,100,100));
Robotcol=new OgreNewt::CollisionPrimitives::Box( mWorld,Vector3(50,50,50));


But not the bodies. Try adding this after it:
OgreNewt::Body* Ogrebody = new OgreNewt::Body(mWorld, Ogrecol);
OgreNewt::Body* Robotbody = new OgreNewt::Body(mWorld, Robotcol);

Now your objects are movable if you add:

Robotbody->attachToNode(Robotnode);


You'll want to try moving them from the origin to test collision, unless you have something to drop them on.

F1rst

15-07-2006 20:17:50

2 HexiDave
I don't need to use a bodyes(a real simulations) because I need
LOW LEVEL collision detection.
I read about OgreNewt::CollisionTools::CollisionCollide in OgreNewt
docs- this function don't need any "bodyes" we can just manually
set position and orientation of our nodes

int OgreNewt::CollisionTools::CollisionCollide ( const OgreNewt::World * world,
int maxSize,
const OgreNewt::Collision * colA,
const Ogre::Quaternion & colOrientA,
const Ogre::Vector3 & colPosA,
const OgreNewt::Collision * colB,
const Ogre::Quaternion & colOrientB,
const Ogre::Vector3 & colPosB,
Ogre::Vector3 * retContactPts,
Ogre::Vector3 * retNormals,
Ogre::Real * retPenetrations
)

manual collision between collision primitives.

This function allows you to perform a manual collision check on 2 collision primitives. the function returns the number of contacts found.

HexiDave

15-07-2006 21:29:23

Oh jeez, sorry - thought you were testing collision abilities first - I completely passed over the line /* Here is crash */ because I thought the whole section was commented out! The forum totally train-wrecked the formatting there hehe...

Perhaps try creating the collisions locally where you test them. I've never used the low-level collision testing, but I'd still imagine you'd need to create a body to move the collision around. I'll have to re-read the docs about that, never messed with it before.

F1rst

16-07-2006 10:13:04

Perhaps try creating the collisions locally where you test them
No, unfortunately, it doesn't work. :cry:
2 Walaber
Say to me please how to use CollisionCollide function and
where is my mistake.Thanks..

walaber

17-07-2006 05:47:11

i haven't tested them to be honest! has any other user used these functions?

they are pretty much direct wraps of Newton functions...

mysterycoder

17-07-2006 07:58:31

I'll probably be using the low-level colisions soon, I'll let you know how it goes. :)

F1rst

17-07-2006 12:08:46

Ok, thanks.
If someone wants to test CollisionTools functions, you can just
insert my source code given above in empty ogrenewt project and compile
it.

F1rst

17-07-2006 18:12:40

Good news!
It was my fault, because I use poiter Vector3 * retc instead of
array Vector3 rect - that's why my program crashes.
Box vs Box collide perfectly.
But I still have another question(Problem mesh vs Mesh) - I will add it in new topic.