Sprite-Kit – Determine the angular moment according to the angular velocity of SkspriteNode

I have a node in space (no angular damping, no friction, no gravity), and I apply a torque (20 Newton meters) in 1 second. It starts to rotate and Lasts forever. If I apply a reaction force (-20 Newton meters), it will stop completely.

If I don’t know how much angular torque was initially applied (e.g. it collides with another object) ), how do I determine what reverse torque is applied to stop the object? I tried angularVelocity* quality, which is close…but always a bit shy (like I missed something):

-physicsBody!.angularVelocity*physicsBody!. mass

How to determine the angular momentum (torque) used to remove all rotations of the object?

In my game, I use active braking to manage the movement of nodes over time. Perform this operation in the update() function. According to your request, I propose this answer:

let X = -0.2 // This needs to be customized by your needs .. how fast you want to stop.
var need_braking_list: [SKSpriteNode] = [] // Append your spinning nodes here

override func update() {
for (index,node) in need_braking_list {
// We're almost stopped, so force a stop or this goes on forever.
if node.physicsBody?.angularVelocity <0.1 &&
node. physicsBody?.angularVelocity> (-0.1)
{
node.physicsBody?.angularVelocity = 0
need_braking_list.removeAtIndex(index)
// Apply some braking ... screeech< br />} else {
let impulse_factor = node.physicsBody?.angularVelocity * (X)
node.physicsBody?.applyAngularImpulse(impulse_factor)
}
}
}

Hope this helps!

I have a node in space (no angular damping, no friction, no gravity) and I apply a torque (20 Newton meters) in 1 second. It It starts to rotate and will continue forever. If I apply a reaction force (-20 Newton meters), it will stop completely.

If I don’t know how much angular torque was initially applied (e.g. it is with Another object collision), how do I determine what reverse torque is applied to stop the object? I tried angularVelocity* quality, which is close…but always a bit shy (like I missed something):

-physicsBody!.angularVelocity*physicsBody!. mass

How to determine the angular momentum (torque) used to remove all rotations of the object?

In my game, I use active braking to manage the movement of nodes over time. I do this in the update() function. According to you Request, I put forward this answer:

let X = -0.2 // This needs to be customized by your needs .. how fast you want to stop.< br />var need_braking_list: [SKSpriteNode] = [] // Append your spinning nodes here

override func update() {
for (index,node) in need_braking_list {
// We're almost stopped, so force a stop or this goes on forever.
if node.physicsBody?.angularVelocity <0.1 &&
node.physicsBody?.angularVelocity> (-0.1)
{
node.physicsBody?.angularVelocity = 0
need_braking_list.removeAtIndex(index)
// Apply some braking ... screeech
} else {
let impulse_factor = node.physicsBody?.angularVelocity * (X)
node.physicsBody?.applyAngularImpulse(impulse_factor)
}
}
}

Hope this helps !

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1723 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.