I think the CreateSphere line is what's slowing it down. Try this...
I'm not certain if a CopyEntity command retains the pickmode, but I am assuming it doesn't.
Graphics3D(640,480,0,2) SetBuffer(BackBuffer()) c = CreateCamera() PositionEntity(c, 0,0,-2) CameraRange(c, .1,5) s = CreateSphere(64) EntityPickMode(s, 2) s1 = CreateSphere(2) EntityColor(s1, 255,0,0) ScaleEntity(s1, .1,.1,.1) s2 = CreateSphere(2) EntityColor(s2, 0,255,0) ScaleEntity(s2, .1,.1,.1) While Not KeyHit(1) t = MilliSecs() CameraPick(c, MouseX(), MouseY()) PositionEntity(s1, PickedX(), PickedY(), PickedZ()) PositionEntity(s2, (MouseX() - 320)/640.0 * 2, -(MouseY() - 240)/480.0 * 2, -1) If MouseHit(1) DebugLog "***********************************" DebugLog "before creation " + (MilliSecs()-t) FreeEntity(n) n = CopyEntity (s) DebugLog "after creation " + (MilliSecs()-t) EntityPickMode(n, 2) EndIf RenderWorld() DebugLog "after renderworld " + (MilliSecs()-t) Flip() Wend End
I'm not certain if a CopyEntity command retains the pickmode, but I am assuming it doesn't.