提交 6a2a28fe 编写于 作者: D dubejf

Extract OrbitConstraint from OrbitControls

OrbitControls takes care of the DOM, input binding and event handling.

OrbitConstraint is responsible for keeping the camera on an orbit, maintaining its orientation towards the target and updating the camera and target position.

There is only one insignificant API change. Before, dolly / rotate functions could be called without parameters to engage autoRotate / autoSpeed. OrbitConstraint does not support that. Now, OrbitControls must provide these parameter explicitly to OrbitConstraint. As far as I can tell, those methods were only used internally and should not be part of the control API.

OrbitControls extends OrbitConstraint. In my ideal implementation, OrbitConstraint should be a property of the OrbitControls, but using inheritence help preserve the existing interface.

OrbitConstraint is not included in the `THREE` namespace. It is defined in a closure and private to this file. It could also the placed in `extras\constraints`, along with other contraints that could be extracted from the current controls, and maybe other type of constraints on the object position/displacement (constrain movement to plane, to path, collision).

These constraints should not necessarily be limited to cameras; they could apply to any objects. It's not clear to me how all this will shape up, but this is a nice place to pause and ask for feedback before going forward.
上级 a73fb6ed
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册