Get distance between camera and ground

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
Locked
Thorben Linneweber

Get distance between camera and ground

Post by Thorben Linneweber »

Hi,

i need to have the distance between the camera and the ground.

Code: Select all

    
Private Function GetOverGround(ByVal isnode As Irrlicht.Scene.ISceneNode) As Long

        Dim il3dHelp As Irrlicht.Core.Line3D
        Dim v3dCollision As Irrlicht.Core.Vector3D
        Dim test As Irrlicht.Core.Triangle3D

        il3dHelp.start = isnode.Position

        il3dHelp.end = New Irrlicht.Core.Vector3D(isnode.Position.X, -3000, isnode.Position.Z)

        smgr.SceneCollisionManager.GetCollisionPoint(il3dHelp, selector, v3dCollision, test)

        GetOverGround = isnode.Position.Y - v3dCollision.Y

    End Function
(the smgr.scenecollisionmanager.getcollisionpoint returns true!)

The idea was to create a line to get the collsionpoint. (Just look at the source. :) ) The problem is, that "v3dCollision.Y" is 0 ...

Do you have any idea why? Is the source correct?

Thank You
Thorben Linneweber

Post by Thorben Linneweber »

:evil: ...

hello,

has anyone an idea why the line is drawn at the wrong place?

Code: Select all

                Dim startV, endV As Irrlicht.Core.Vector3D
                Dim lnC As Irrlicht.Video.Color

                startV = CamMain.Position
                endV = CamMain.Position.op_Addition(CamMain.Position, New Vector3D(0, 1000, 0))

                lnC = New Irrlicht.Video.Color(0, 255, 255, 255)
                driver.Draw3DLine(startV, endV, lnC)

                smgr.DrawAll()
In c++ it worked well...Maybe a Bug in the wrapper???


Thorben
Locked