Animation and pointer issue.
Blitz3D Forums/Blitz3D Programming/Animation and pointer issue.
| ||
Hello, anyone who is sly with pointer(handles) and knows about animation and wants to help... well, it would be appreciated. Basically my animation system is using types moving parts around, no mesh deformation etc. EG. Type animation total_frames frame% Positionx,y,z Rotationx,y,z End type So there are a lot of animations etc. This works out with the exception of the fact that I have to iterate through every frame of animation before I can pull out the object I want to reference data from. Is there a logical quick way to use pointers and assign animations to them? Something similar to this? DIM total_anims(1000) Idle is anim[0] through anim[14] Walking is anim[15] through anim[30] Even with the info ive found in the code archives, I still seem to being having problems using pointers. Does anyone want to help me with my animation system, or at least point me in the right direction? Thanks, Scott |
| ||
You could store the handles of your types into the array. For example if you want to create the first frame in a walk cycle:Local a.animation a = new animation a\xxx = xxx AnimArray[15] = Handle(a) Then retrieve that type instance with Local a.animation a = Object.animation( AnimArray[15] ) Should work... :] |
| ||
Ok, I think i get the idea thanks. My script engine is working, and well everytime you enter and leave a "world" or level screen whatever, it loads an init script that completely wipes the memory and loads only what is needed. so if I leave section A using this character and walking, those same animation objects could be a swimming frame next time around, depends on what animation loads are called. It works great for me, but I hate iterating through all this crap its causing like 5-30 ms slow downs. I know it doesnt sound like a lot, but I have yet to code any AI, and im better, that even when I create some threads to limit the ammount of ai checks performed each frame, that I will need all the speed I can get. Thanks again. Welcome to other ideas if anyone has them as well. |
| ||
Why not just store the the start and end frame of the animation in the type object? |
| ||
Ok, well it seemed like a good idea. Now i get the error "Identified 'animarray' may not be used like this" when trying to do the following. Dim AnimArray(100) Type animation Field name$ Field frame% Field start_frame% Field end_frame% Field whatever End Type For testloop = 1 To 100 t%=0 Local a.animation a = New animation a\name$ = "testanim" a\frame%=testloop AnimArray[t%] = Handle(a) Next So any ideas on how to go about this? I need to be able to do this without having static sections used for the arrays... to just add to total animations array on an as needed basis. |
| ||
You should use round brackets here: AnimArray[t%] = Handle(a) <-- AnimArray(t%) = Handle(a) |