Forum Replies Created
- 
		AuthorPosts
 - 
		
			
				
It’s pretty interesting.
Running on iPad Pro:

Here is another test for loading animated 3d models:
– http://monkeycoder.co.nz/forums/topic/loading-animated-3d-models/Hello En929,
Monkey2 supports animations. Download latest Monkey2 and run the following examples:
– Monkey2/modules/mojo3d-loaders/tests/ninja.monkey2
– Monkey2/modules/mojo3d-loaders/tests/turtle.monkey2Monkey2 is using Assimp for import/export 3D models/scenes. See HERE for supported file formats.
Also look at the other examples:
– Monkey2/modules/mojo3d/testsIn many virus scanners you can add a folder (“C:\Monkey2-v2018.09\”) for exclusion from scanning.
If your development tools (C++ compiler, linker, libs) or system could be infected, this could infect your compiled programs as well. If that’s not the case, you can exclude your source folders.
Really nice, @druggedbunny!
Sounds good. I‘m glad everything is going well…
So @abakobo was right with his way of copying everything.
We can make this for 3 dimensions:
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107'' http://monkeycoder.co.nz/forums/topic/multidimensional-arrays-and-copyto/'Function CloneArray<T>:T[](Arr:T[]) ' 1 dimensionLocal x := Arr.GetSize(0)Local newArr := New T[x]For local i:=0 Until xnewArr[i] = Arr[i]NextReturn newArrEndFunction CloneArray<T>:T[,](Arr:T[,]) ' 2 dimensionsLocal x := Arr.GetSize(0)Local y := Arr.GetSize(1)Local newArr := New T[x,y]For local i:=0 Until xFor Local j:=0 Until ynewArr[i,j]=Arr[i,j]NextNextReturn newArrEndFunction CloneArray<T>:T[,,](Arr:T[,,]) ' 3 dimensionsLocal x := Arr.GetSize(0)Local y := Arr.GetSize(1)Local z := Arr.GetSize(2)Local newArr:=New T[x,y,z]For local i:=0 Until xFor Local j:=0 Until yFor Local k:=0 Until znewArr[i,j,k]=Arr[i,j,k]NextNextNextReturn newArrEnd'===================================Function Main()Print "1 dimension:"Test1D()Print "2 dimensions:"Test2D()Print "3 dimensions:"Test3D()EndFunction Test1D()Local arr1D := New String[]( "a", "b", "c" )Local copy1D := CloneArray(arr1D)copy1D[1] = "d"Print arr1D[0]Print arr1D[1]Print arr1D[2]Print "==="Print copy1D[0]Print copy1D[1]Print copy1D[2]EndFunction Test2D()Local arr2D := New Int[5,5]arr2D[3,3] = 33Local copy2D := CloneArray(arr2D)Print copy2D[3,3]Print copy2D[4,4]arr2D[4,4] = 44Print copy2D[3,3]Print copy2D[4,4]EndFunction Test3D()Local arr3D := New Float[3,3,3]arr3D[0,1,2] = 1.5Local copy3D := CloneArray(arr3D)Print arr3D[0,1,2]Print copy3D[0,1,2]copy3D[0,1,2] = 2.5Print arr3D[0,1,2]Print copy3D[0,1,2]End@pakz:
Looks like this is not a real copy:Monkey12345678910111213141516171819202122232425#Import "<std>"Using std..Function Copy2DArray<T>:T[,](in:T[,])Return inEndFunction Main()Local arr1 := New Int[5,5]arr1[3,3] = 33Print arr1[3,3]Local arr2 := Copy2DArray(arr1)Print arr2[3,3]Print arr2[4,4]arr1[4,4] = 44 ' change arr1...Print arr2[3,3]Print arr2[4,4] ' ...arr2 is also changedEndList extension ‘ForEach’ & ‘ForEachBackwards’ for use with structs:
Monkey12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182#Import "<std>"Using std..Class List<T> ExtensionMethod ForEach:Void( func:T(item:T) )Local iterator := Self.All()While Not iterator.AtEnditerator.Current = func(iterator.Current)iterator.Bump()WendEndMethod ForEachBackwards:Void( func:T(item:T) )Local iterator := Self.Backwards()While Not iterator.AtEnditerator.Current = func(iterator.Current)iterator.Bump()WendEndEndFunction Main()'' Randomize Rnd values'Sleep( Rnd(1.0) )SeedRnd( Microsecs() )'' Create a linked list using Vec2f type'Local lst := New List< Vec2f >'' Add elememts to the list'For Local n := 0 Until 10lst.Add( New Vec2f )Next'' Set values'lst.ForEach( Lambda:Vec2f( element:Vec2f )Global count:Int = 0count += 1element.x = countelement.y = Rnd( 100.0 )Return elementEnd )'' print values'For Local item := Eachin lstPrint item.x + "~t" + item.yEndPrint "----------"'' Change all 'x' values in the list'lst.ForEachBackwards( Lambda:Vec2f( element:Vec2f )element.x += 100Return elementEnd )'' print values'For Local item := Eachin lstPrint item.x + "~t" + item.yEndEndBoth should use the same node class, yes.
How is the type of i.path declared? It should use same, List<Node> or NodeList alias.
Because the type of i.path is already known, you can’t use operator := there.
Monkey12'Local lst := mypath.getpath()i.path = mypath.getpath()EDIT:
Looks like you are using 2 different Classes! pathfinder.pathnode and unit.pathnode –
can’t you use one pathnode for both?Could you use this?
Monkey1234567891011121314151617181920212223242526#Import "<std>"Using std..Function Main()Local arr := New Int[][10]For Local i := 0 Until 10arr[i] = New Int[10]Nextarr[3][3] = 33arr[4][4] = 44arr[5][5] = 55Local arr2 := New Int[][10]arr.CopyTo(arr2,0,0,arr.Length)Print arr2[3][3]Print arr2[4][4]Print arr2[5][5]EndIf you mean multimensional [10,10] arrays, I don’t know.
Using List<Node> directly:
Monkey12345678910111213141516171819202122232425262728293031323334353637#Import "<std>"Using std..Class NodeField x:IntMethod New(num:Int)x = numEndEndClass TestField path:List<Node> = New List<Node>Method New()path.AddLast( New Node(101) )path.AddLast( New Node(102) )path.AddLast( New Node(103) )EndMethod GetPath:List<Node>()Return pathEndEndFunction Main()Local tst := New TestLocal lst := tst.GetPath()For Local item := Eachin lstPrint item.xEndEndUsing an Alias:
Monkey12345678910111213141516171819202122232425262728293031323334353637383940#Import "<std>"Using std..Alias NodeList:List<Node>Class NodeField x:IntMethod New(num:Int)x = numEndEndClass TestField path:NodeList = New NodeListMethod New()path.AddLast( New Node(101) )path.AddLast( New Node(102) )path.AddLast( New Node(103) )EndMethod GetPath:NodeList()Return pathEndEndFunction Main()Local tst := New TestLocal lst := tst.GetPath()For Local item := Eachin lstPrint item.xEndEnd - 
		AuthorPosts