A Colision Problem By Hitting The Ground!!!!!!

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
alfabeta90
Posts: 52
Joined: Wed Dec 06, 2006 5:18 pm

A Colision Problem By Hitting The Ground!!!!!!

Post by alfabeta90 »

Hello, I wrote some colisions and i compiled the program, but when i executed program i fall from air way the ground and when the moment comes when i must touth the ground i see nothing. Sorry for me English. Compile the belowe code to see what i mean.

Code: Select all

using System;
using Irrlicht;
using Irrlicht.Video;
using Irrlicht.Core;
using Irrlicht.Scene;

namespace MyFirstApplicationInCSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            Program newGame = new Program();
            newGame.uruchomGre();
        }

        public void uruchomGre()
        {
            IrrlichtDevice oknoGry = new IrrlichtDevice(DriverType.DIRECT3D8, new Irrlicht.Core.Dimension2D(800, 600), 32, false, true, false);
            oknoGry.WindowCaption = "KSEkspert Gra";
            oknoGry.FileSystem.AddZipFileArchive("media/map-20kdm2.pk3");

            IAnimatedMesh poziomGry = oknoGry.SceneManager.GetMesh("20kdm2.bsp");
            ISceneNode wezelPoziomuGry = oknoGry.SceneManager.AddOctTreeSceneNode(poziomGry.GetMesh(0), null, 0);
            wezelPoziomuGry.Position = new Vector3D(0, 0, 0);

            ICameraSceneNode wezelKamery = oknoGry.SceneManager.AddCameraSceneNodeFPS(null, 100, 300, 0);
            wezelKamery.Position = new Vector3D(1000,1000,500);
            wezelKamery.Rotation = new Vector3D(0,180,0);
            oknoGry.CursorControl.Visible = false;

            ITriangleSelector selektor = oknoGry.SceneManager.CreateOctTreeTriangleSelector(poziomGry.GetMesh(0), wezelPoziomuGry, 128);
            ISceneNodeAnimator detektorKolizjiKamery = oknoGry.SceneManager.CreateCollisionResponseAnimator(selektor, wezelKamery, new Vector3D(30, 40, 30), new Vector3D(0, 0.0f, 0), new Vector3D(0,15,0),0);
            wezelKamery.AddAnimator(detektorKolizjiKamery);


            while (oknoGry.Run())
            {
                if (oknoGry.WindowActive)
                {
                    oknoGry.VideoDriver.BeginScene(true, true, new Color(0, 200, 200, 200));
                    oknoGry.SceneManager.DrawAll();
                    oknoGry.VideoDriver.EndScene();
                }
            }
        }

 
    }
}
Last edited by alfabeta90 on Mon May 14, 2007 4:00 pm, edited 1 time in total.
alfabeta90
Posts: 52
Joined: Wed Dec 06, 2006 5:18 pm

Post by alfabeta90 »

Any help?
cylicht
Posts: 18
Joined: Mon May 07, 2007 6:54 pm

Post by cylicht »

I think that your camera is falling through the floor.

Try changing from this:

Code: Select all

ISceneNodeAnimator detektorKolizjiKamery = oknoGry.SceneManager.CreateCollisionResponseAnimator(selektor, wezelKamery, new Vector3D(30, 40, 30), new Vector3D(0, 0.0f, 0), new Vector3D(0,15,0),0); 
To This:

Code: Select all

ISceneNodeAnimator detektorKolizjiKamery = oknoGry.SceneManager.CreateCollisionResponseAnimator(selektor, wezelKamery, new Vector3D(30, 40, 30), new Vector3D(0, 0.0f, 0), new Vector3D(0,15,0),0.1f); 
alfabeta90
Posts: 52
Joined: Wed Dec 06, 2006 5:18 pm

Post by alfabeta90 »

Now its works perfect. Thx.
Post Reply