Page 1 of 1

Tip for VB.NET Irrlicht Developers

Posted: Mon Feb 20, 2006 6:25 am
by Ash Moollan
Hi Fellow VB Developers!

Operator Overloading isn't supported in VB, so stuff like

Dim v1 As Vector3D
Dim v2 As Vector3D
Dim v3 As Vector3D = v1 - v2 ' this wont work!

The minus operator is defined in the Irrlicht.NET assembly as

Public Static Vector3D Operator -(Vector3D o1, Vectr3D ) {...}

And because Operator Overloading isnt CLS-Compliant per se, you cannot call that from a .NET language that does not support it (e.g. VB.NET)

However, by default, when the c# is compiled, the compiler by will add special methods for the overloaded operators
op_Addition()
op_Substraction() etc

so we should be doing something like
VB:
Dim v1 As Vector3D
Dim v2 As Vector3D
Dim v3 As Vector3D = Vector3D.op_Substractio(v1, v2)

While this *should* work, by default it doesn't, even though these methods are added (and documented in IrrLicht .NET CHM documentation) these methods do not come up in VB.

Here's the Tip:
Click on Tools>Options (Inside Visual Studio)
Text Editor>Basic
and UnCheck "Hide advanced members"

and that should do the trick!

Cheers
Ash Moollan
Blog: www.moollan.net

Posted: Tue Mar 14, 2006 8:45 am
by RapchikProgrammer
Hey nice tip bro! But as i am an old programmer of vb6 i always create a helper module in which these kind of stuff could be done like add, subtract or multiply matrices or vectors!