Something like this maybe. Creates another pivot attached to the clamp in this case and adjusted for position and orientation. Spacebar lets you free the camera and fly around with the mouse. Note I don't actually attach the camera to the pivot, could do but it usually involves some tricky scale problems when working with scaled hierarchies.
; Fully Articulated Robotic Arm ; By Reda Borchardt Include "start.bb" Include "keyconstants.bb" message=1 banner = LoadImage("top-banner.jpg") MaskImage banner,255,255,0 ; Load the object and assign a handle to all sub-objects robotarm = LoadAnimMesh("ROBOTIC-ARM.3DS") stand = FindChild(robotarm,"stand") upperarm = FindChild(robotarm,"upperarm") lowerarm = FindChild(robotarm,"lowerarm") wrist = FindChild(robotarm,"wrist") clamp = FindChild(robotarm,"clamp") cpivot=CreatePivot(clamp) ; create a pivot to attach our camera to, and rotate it to point correctly PositionEntity cpivot,-20,-15,0 RotateEntity cpivot,0,90,180 ; Add Some Light AmbientLight 0,0,255 light = CreateLight(1) TurnEntity light,60,60,0 ; Load The Camera And Put It Into A Pivot With Two Axes horizontal_camera_pivot = CreatePivot() vertical_camera_pivot = CreatePivot(horizontal_camera_pivot) camera = CreateCamera(vertical_camera_pivot) camera2=CreateCamera() CameraRange camera2,0.1,200 CameraZoom camera2,2 CameraViewport camera2,0,GraphicsHeight()-200,200,200 ; simple room cube=CreateCube() EntityColor cube,200,200,80 FitMesh cube,-50,0,-50,100,50,100 FlipMesh cube ; some objects SeedRnd 500 For i=0 To 10 box=CreateCube() FitMesh box,-2,0,-2,4,4,4 PositionEntity box,Rand(-40,40),0,Rand(-40,40) TurnEntity box,0,Rand(-180,180),0 EntityColor box,200,200,0 Next ; Put The Camera Somewhere And Resize The Model To A Reasonable Size ScaleEntity robotarm,0.1,0.1,0.1 PositionEntity camera,0,30,-40 PointEntity camera,horizontal_camera_pivot spd#=1 camspd#=0.25 While Not KeyHit(1) mxs#=MouseXSpeed() mys#=MouseYSpeed() MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 spd=spd#+(KeyHit(13)-KeyHit(12))*0.1 If spd<0.1 Then spd=0.1 If KeyDown(key_q) Then TurnEntity stand,0,spd,0 If KeyDown(key_a) Then TurnEntity stand,0,-spd,0 If KeyDown(key_w) Then TurnEntity upperarm,0,0,spd If KeyDown(key_s) Then TurnEntity upperarm,0,0,-spd If KeyDown(key_e) Then TurnEntity lowerarm,0,0,-spd If KeyDown(key_d) Then TurnEntity lowerarm,0,0,spd If KeyDown(key_r) Then TurnEntity wrist,0,0,spd If KeyDown(key_f) Then TurnEntity wrist,0,0,-spd If KeyDown(key_t) Then TurnEntity clamp,spd,0,0 If KeyDown(key_g) Then TurnEntity clamp,-spd,0,0 If KeyDown(key_arrowpad_up) Then TurnEntity vertical_camera_pivot,spd,0,0 If KeyDown(key_arrowpad_down) Then TurnEntity vertical_camera_pivot,-spd,0,0 If KeyDown(key_arrowpad_left) Then TurnEntity horizontal_camera_pivot,0,-spd,0 If KeyDown(key_arrowpad_right) Then TurnEntity horizontal_camera_pivot,0,spd,0 PointEntity camera,horizontal_camera_pivot If KeyHit(57) Then fly=Not fly ; spacebar If fly Then If MouseDown(1) Then MoveEntity camera2,mxs*camspd,0,-mys*camspd Else TurnEntity camera2,-mys*camspd,0,0,False TurnEntity camera2,0,-mxs*camspd,0,True EndIf Else PositionEntity camera2,EntityX(cpivot,1),EntityY(cpivot,1),EntityZ(cpivot,1) RotateEntity camera2,EntityPitch(cpivot,1),EntityYaw(cpivot,1),EntityRoll(cpivot,1) EndIf UpdateWorld RenderWorld DrawImage banner,0,0 ; delineate 2nd camera screen Rect 0,GraphicsHeight()-200,200,200,0 If KeyHit(Key_h) message=Not message If KeyHit(key_z) Then WireMode = Not WireMode WireFrame WireMode End If If message Then Text 0,100,"Robotic Arm" Text 0,120,"Keys: Use Keys Q to T and A to G" Text 0,140,"Use The Arrow Keys To Move The Camera" Text 0,160,"Use +/- keys to change speed" Text 0,180,"Keys: 'Z' to toggle wireframe mode" Text 0,200,"Keys: H to hide/show this message" End If Flip Wend