Spin box/camera around with velocity in SceneKit -
aspects of .allowcameracontrol perfect use. i'm rotating camera node (child of sphere) around cube. i'd have spinning gradually come halt (like allowscameracontrol).
can assist in direction of how stop spinning based on velocity of gesture? add friction camera?
i spent lot of time working on this, , it's tricky subject. best approach found to:
- save past 10 or drag events every frame
- on release, calculate velocity x , y axis based on these frames
- keep moving camera using these velocity values
- every frame, dampen velocity. looking @ spring equations make more realistic
- when velocity under small threshold, stop moving avoid endless drifting
Comments
Post a Comment