SetTriangleSelector in .NET?
SetTriangleSelector in .NET?
hi, i noticed that the SetTriangleSelector method or TriangleSelector property of the node class is not there in the .net wrapper version.
is it somewhere else? am i missing it? i believe it is required in order to do basic collision detection, correct?
thanks
is it somewhere else? am i missing it? i believe it is required in order to do basic collision detection, correct?
thanks
-
- Posts: 279
- Joined: Fri Dec 24, 2004 6:37 pm
I am about to upload one application made using vb.net that shows the usage of several functions in vb.net! But for now this is going to help:
cam is the camera! I hope this was helpful!
Code: Select all
Dim BSP As Irrlicht.Scene.IAnimatedMesh
Dim Node As Irrlicht.Scene.ISceneNode
Public Selector As Irrlicht.Scene.ITriangleSelector
Dim ColAnim As Irrlicht.Scene.ISceneNodeAnimator
Public Sub LoadPK3(ByVal FilePath As String, ByVal BSPFile As String)
Device.FileSystem.AddZipFileArchive(FilePath)
BSP = Device.SceneManager.GetMesh(BSPFile)
If Not BSP Is Nothing Then
Node = Device.SceneManager.AddOctTreeSceneNode(BSP, Nothing, -1, 128)
End If
End Sub
Public Sub SetCollision(ByVal SphereRadiusX As Single, ByVal SphereRadiusY As Single, ByVal SphereRadiusZ As Single, ByVal Gravity As Single)
If Not Node Is Nothing Then
Selector = Device.SceneManager.CreateOctTreeTriangleSelector(BSP.GetMesh(0), Node, 128)
End If
ColAnim = Device.SceneManager.CreateCollisionResponseAnimator(Selector, Cam, _
New Vector3D(SphereRadiusX, SphereRadiusY, SphereRadiusZ), _
New Vector3D(0, Gravity, 0), _
New Vector3D(0, 50, 0), _
0.0005F)
If ColAnim Is Nothing Then
MsgBox("Error creating collision manager! Did you setup the camera after loading the map?")
Return
End If
Cam.AddAnimator(ColAnim)
ColAnim = Nothing
End Sub
Ok, so far I recompiled my modified wrapper, to which I added support for the TabControl and the TriangleSelector
TabControl works ok, but I couldn't do extensive tests on triangle selectors, since I could not (at least in my project) build a correct line for the intersection so far (but hey, I could only code & compile it yesterday 11pm, so please be patient)
Is anyone interested in the code?
I'm also working on a port of the grass node to c# .NET, cause I need it in my c# project, more info soon
TabControl works ok, but I couldn't do extensive tests on triangle selectors, since I could not (at least in my project) build a correct line for the intersection so far (but hey, I could only code & compile it yesterday 11pm, so please be patient)
Is anyone interested in the code?
I'm also working on a port of the grass node to c# .NET, cause I need it in my c# project, more info soon
-
- Posts: 279
- Joined: Fri Dec 24, 2004 6:37 pm
-
- Posts: 279
- Joined: Fri Dec 24, 2004 6:37 pm
ok, here I am so far:
- could modify Irrlicht.NET to add the TriangleSelector
- could get an instance of the triangle selector
- still could not get an intersection point...
I'm now struggling with the getTriangles method, since the first parameter seems to be an array, but is referenced as a triangle3df* pointer, and I don't really know how to translate that into .NET, but with an Array... which I would fill within this method, and return as an out param, or even just an array param...
has anyone already tried that? also, I'm suprised in my client App to have my getCollisionPoint always returning false, but I guess it's due to my bad implementation of getTriangles...
- could modify Irrlicht.NET to add the TriangleSelector
- could get an instance of the triangle selector
- still could not get an intersection point...
I'm now struggling with the getTriangles method, since the first parameter seems to be an array, but is referenced as a triangle3df* pointer, and I don't really know how to translate that into .NET, but with an Array... which I would fill within this method, and return as an out param, or even just an array param...
has anyone already tried that? also, I'm suprised in my client App to have my getCollisionPoint always returning false, but I guess it's due to my bad implementation of getTriangles...
Currently working on a C# MMORPG using Irrlicht.NET
-
- Posts: 279
- Joined: Fri Dec 24, 2004 6:37 pm
actually I used the project file in Irrlicht.NET 0.12 and added the files found in the 0.14 archive. The problem is that the source files don't implement all functionnalities (i recently found out that the DLL version implemented AddParticlSceneNode, whereas the sources don't... Niko? :p )
Currently working on a C# MMORPG using Irrlicht.NET