I could really use some help. My animation engine loads multiple objects and then rotates them based on the snapshot of the animation. It runs great, with a couple of objects, when 4 or more are introduced it lags really badly. Any ideas on this, as this machine + blitz should allow 100 objects to rotate around easily without this kind of slow down.
Dim AnimArray(10000) Type animation Field name$ Field frame% Field max_frames% Field start_frame% Field end_frame% Field looping ;stored on load Field head_px#,head_py#,head_pz# Field head_rx#,head_ry#,head_rz# Field chest_px#,chest_py#,chest_pz# Field chest_rx#,chest_ry#,chest_rz# Field hip_px#,hip_py#,hip_pz# Field hip_rx#,hip_ry#,hip_rz# Field L_arm_px#,L_arm_py#,L_arm_pz# Field L_arm_rx#,L_arm_ry#,L_arm_rz# Field R_arm_px#,R_arm_py#,R_arm_pz# Field R_arm_rx#,R_arm_ry#,R_arm_rz# Field L_forearm_px#,L_forearm_py#,L_forearm_pz# Field L_forearm_rx#,L_forearm_ry#,L_forearm_rz# Field R_forearm_px#,R_forearm_py#,R_forearm_pz# Field R_forearm_rx#,R_forearm_ry#,R_forearm_rz# Field L_hand_px#,L_hand_py#,L_hand_pz# Field L_hand_rx#,L_hand_ry#,L_hand_rz# Field R_hand_px#,R_hand_py#,R_hand_pz# Field R_hand_rx#,R_hand_ry#,R_hand_rz# Field L_leg_px#,L_leg_py#,L_leg_pz# Field L_leg_rx#,L_leg_ry#,L_leg_rz# Field R_leg_px#,R_leg_py#,R_leg_pz# Field R_leg_rx#,R_leg_ry#,R_leg_rz# Field L_shin_px#,L_shin_py#,L_shin_pz# Field L_shin_rx#,L_shin_ry#,L_shin_rz# Field R_shin_px#,R_shin_py#,R_shin_pz# Field R_shin_rx#,R_shin_ry#,R_shin_rz# Field L_foot_px#,L_foot_py#,L_foot_pz# Field L_foot_rx#,L_foot_ry#,L_foot_rz# Field R_foot_px#,R_foot_py#,R_foot_pz# Field R_foot_rx#,R_foot_ry#,R_foot_rz# End Type Function do_animations(animation_delay) animation_frameskip=animation_frameskip + 1 If animation_frameskip=>animation_delay Then For b.model=Each model looping%=1 B\on_frame%=B\on_frame%+1 If looping%=1 Then If B\on_frame% > B\end_frame% Then B\on_frame%=B\start_frame% Else If B\on_frame% > B\end_frame% Then B\on_frame%=B\end_frame%-1 End If playframe(b\name$,B\on_frame%) Next animation_frameskip=0 End If End Function Function playframe(model$,frame%) For M.model=Each model If M\name$=model$ Then Local a.animation a = Object.animation( AnimArray(frame%) ) PositionEntity M\head,A\head_px#,A\head_py#,A\head_pz# RotateEntity M\head,A\head_rx#,A\head_ry#,A\head_rz# PositionEntity M\chest,A\chest_px#,A\chest_py#,A\chest_pz# RotateEntity M\chest,A\chest_rx#,A\chest_ry#,A\chest_rz# PositionEntity M\hip,A\hip_px#,A\hip_py#,A\hip_pz# RotateEntity M\hip,A\hip_rx#,A\hip_ry#,A\hip_rz# PositionEntity M\l_arm,A\l_arm_px#,A\l_arm_py#,A\l_arm_pz# RotateEntity M\l_arm,A\l_arm_rx#,A\l_arm_ry#,A\l_arm_rz# PositionEntity M\l_forearm,A\l_forearm_px#,A\l_forearm_py#,A\l_forearm_pz# RotateEntity M\l_forearm,A\l_forearm_rx#,A\l_forearm_ry#,A\l_forearm_rz# PositionEntity M\l_hand,A\l_hand_px#,A\l_hand_py#,A\l_hand_pz# RotateEntity M\l_hand,A\l_hand_rx#,A\l_hand_ry#,A\l_hand_rz# PositionEntity M\r_arm,A\r_arm_px#,A\r_arm_py#,A\r_arm_pz# RotateEntity M\r_arm,A\r_arm_rx#,A\r_arm_ry#,A\r_arm_rz# PositionEntity M\r_forearm, A\r_forearm_px#,A\r_forearm_py#,A\r_forearm_pz# RotateEntity M\r_forearm,A\r_forearm_rx#,A\r_forearm_ry#,A\r_forearm_rz# PositionEntity M\r_hand,A\r_hand_px#,A\r_hand_py#,A\r_hand_pz# RotateEntity M\r_hand,A\r_hand_rx#,A\r_hand_ry#,A\r_hand_rz# PositionEntity M\l_leg,A\l_leg_px#,A\l_leg_py#,A\l_leg_pz# RotateEntity M\l_leg,A\l_leg_rx#,A\l_leg_ry#,A\l_leg_rz# PositionEntity M\l_shin,A\l_shin_px#,A\l_shin_py#,A\l_shin_pz# RotateEntity M\l_shin,A\l_shin_rx#,A\l_shin_ry#,A\l_shin_rz# PositionEntity M\l_foot,A\l_foot_px#,A\l_foot_py#,A\l_foot_pz# RotateEntity M\l_foot,A\l_foot_rx#,A\l_foot_ry#,A\l_foot_rz# PositionEntity M\r_leg,A\r_leg_px#,A\r_leg_py#,A\r_leg_pz# RotateEntity M\r_leg,A\r_leg_rx#,A\r_leg_ry#,A\r_leg_rz# PositionEntity M\r_shin,A\r_shin_px#,A\r_shin_py#,A\r_shin_pz# RotateEntity M\r_shin,A\r_shin_rx#,A\r_shin_ry#,A\r_shin_rz# PositionEntity M\r_foot,A\r_foot_px#,A\r_foot_py#,A\r_foot_pz# RotateEntity M\r_foot,A\r_foot_rx#,A\r_foot_ry#,A\r_foot_rz# End If Next End Function Function loadanimations(filename$) filein=ReadFile("animations" + filename$ + ".ani") tot_anims%=ReadInt(filein) total_frames%=tot_anims% start_frame%=animations_loaded end_frame%=animations_loaded + tot_anims% For loadcount = 0 To tot_anims A.animation=New animation a\start_frame%=start_frame% a\end_frame%=end_frame% max_frames%=ReadInt(filein) A\name$=ReadString (filein) A\looping%=looping% A\frame%=ReadInt (filein) ;head A\head_px#=ReadFloat(filein) A\head_py#=ReadFloat(filein) A\head_pz#=ReadFloat(filein) A\head_rx#=ReadFloat(filein) A\head_ry#=ReadFloat(filein) A\head_rz#=ReadFloat(filein) ;chest A\chest_px#=ReadFloat(filein) A\chest_py#=ReadFloat(filein) A\chest_pz#=ReadFloat(filein) A\chest_rx#=ReadFloat(filein) A\chest_ry#=ReadFloat(filein) A\chest_rz#=ReadFloat(filein) ;hip A\hip_px#=ReadFloat(filein) A\hip_py#=ReadFloat(filein) A\hip_pz#=ReadFloat(filein) A\hip_rx#=ReadFloat(filein) A\hip_ry#=ReadFloat(filein) A\hip_rz#=ReadFloat(filein) ;left arm A\l_arm_px#=ReadFloat(filein) A\l_arm_py#=ReadFloat(filein) A\l_arm_pz#=ReadFloat(filein) A\l_arm_rx#=ReadFloat(filein) A\l_arm_ry#=ReadFloat(filein) A\l_arm_rz#=ReadFloat(filein) A\l_forearm_px#=ReadFloat(filein) A\l_forearm_py#=ReadFloat(filein) A\l_forearm_pz#=ReadFloat(filein) A\l_forearm_rx#=ReadFloat(filein) A\l_forearm_ry#=ReadFloat(filein) A\l_forearm_rz#=ReadFloat(filein) A\l_hand_px#=ReadFloat(filein) A\l_hand_py#=ReadFloat(filein) A\l_hand_pz#=ReadFloat(filein) A\l_hand_rx#=ReadFloat(filein) A\l_hand_ry#=ReadFloat(filein) A\l_hand_rz#=ReadFloat(filein) ;right arm A\r_arm_px#=ReadFloat(filein) A\r_arm_py#=ReadFloat(filein) A\r_arm_pz#=ReadFloat(filein) A\r_arm_rx#=ReadFloat(filein) A\r_arm_ry#=ReadFloat(filein) A\r_arm_rz#=ReadFloat(filein) A\r_forearm_px#=ReadFloat(filein) A\r_forearm_py#=ReadFloat(filein) A\r_forearm_pz#=ReadFloat(filein) A\r_forearm_rx#=ReadFloat(filein) A\r_forearm_ry#=ReadFloat(filein) A\r_forearm_rz#=ReadFloat(filein) A\r_hand_px#=ReadFloat(filein) A\r_hand_py#=ReadFloat(filein) A\r_hand_pz#=ReadFloat(filein) A\r_hand_rx#=ReadFloat(filein) A\r_hand_ry#=ReadFloat(filein) A\r_hand_rz#=ReadFloat(filein) ;left leg A\l_leg_px#=ReadFloat(filein) A\l_leg_py#=ReadFloat(filein) A\l_leg_pz#=ReadFloat(filein) A\l_leg_rx#=ReadFloat(filein) A\l_leg_ry#=ReadFloat(filein) A\l_leg_rz#=ReadFloat(filein) A\l_shin_px#=ReadFloat(filein) A\l_shin_py#=ReadFloat(filein) A\l_shin_pz#=ReadFloat(filein) A\l_shin_rx#=ReadFloat(filein) A\l_shin_ry#=ReadFloat(filein) A\l_shin_rz#=ReadFloat(filein) A\l_foot_px#=ReadFloat(filein) A\l_foot_py#=ReadFloat(filein) A\l_foot_pz#=ReadFloat(filein) A\l_foot_rx#=ReadFloat(filein) A\l_foot_ry#=ReadFloat(filein) A\l_foot_rz#=ReadFloat(filein) ;right leg A\r_leg_px#=ReadFloat(filein) A\r_leg_py#=ReadFloat(filein) A\r_leg_pz#=ReadFloat(filein) A\r_leg_rx#=ReadFloat(filein) A\r_leg_ry#=ReadFloat(filein) A\r_leg_rz#=ReadFloat(filein) A\r_shin_px#=ReadFloat(filein) A\r_shin_py#=ReadFloat(filein) A\r_shin_pz#=ReadFloat(filein) A\r_shin_rx#=ReadFloat(filein) A\r_shin_ry#=ReadFloat(filein) A\r_shin_rz#=ReadFloat(filein) A\r_foot_px#=ReadFloat(filein) A\r_foot_py#=ReadFloat(filein) A\r_foot_pz#=ReadFloat(filein) A\r_foot_rx#=ReadFloat(filein) A\r_foot_ry#=ReadFloat(filein) A\r_foot_rz#=ReadFloat(filein) AnimArray(animations_loaded) = Handle(a) animations_loaded=animations_loaded+1 Next CloseFile(filein) End Function