ios - How to Spin a Sprite Node by a particular force like fidget spinner -
i want spin sprite node particular force fidget spinner. when user moves finger on screen fast spinner spins faster , when user moves finger slower on screen spinner (skspritenode) spins slower.
have image of spinner assign node. want check in position stops, have list of items around node , depending on stopped, want select item. know have apply angular impulse don't know how calculate value.
like more force applied faster touch (like real spinner)
this i'm doing:
fidgetspinner.physicsbody?.applyangularimpulse(5)
angular impulse correct way go, apply force move entire body in linear fashion. physics bodies done in unit of newtons/(seconds * seconds) (with exception of applyforce, uses pixels due bug). 150 points on scene.
you need fancy extension conversions you
extension cgfloat { public var tonewtons : cgfloat { return self / 150.0 } } then use it, need
let distanceinnewtons = distanceoftouch.tonewtons node.physicsbody?.applyangularimpulse(distanceinnewtons)
Comments
Post a Comment