Questions tagged [skphysicsjoint]

An SKPhysicsJoint object connects two physics bodies together so that they are simulated together by the physics world. You never instantiate objects of this class directly; instead, you instantiate one of the subclasses that defines the kind of joint you want to make. This class implements the common properties of the joint classes provided by Sprite Kit.

An SKPhysicsJoint object connects two physics bodies together so that they are simulated together by the physics world. You never instantiate objects of this class directly; instead, you instantiate one of the subclasses that defines the kind of joint you want to make. This class implements the common properties of the joint classes provided by Sprite Kit.

Click Here for Apple Docs of SKPhysicsJoint

74 questions
7
votes
1 answer

How to rotate sprites around a joint

I need to make the arms and hands rotate around the center of the hook, as shown in the image below without them separating or changing their shape (no changes in the angles between arms and hands just rotation at A), as in the image below: I tried…
Containment
  • 239
  • 2
  • 12
7
votes
1 answer

SKSpriteNode subclass: method to remove all joints

I have created a subclass of SKSpriteNode. I connect instances of that class together with joints of type SKPhysicsJointLimit. I do this within my didEndContact(contact: SKPhysicsContact) in my GameScene: var joint =…
silmor-vie
  • 101
  • 5
7
votes
2 answers

Incorrect behaviour with SKPhysicsJointPin when shouldEnableLimits is true and lowerAngleLimit and upperAngleLimit set

I currently have a ragdoll figure, which consists of a parent node (with no physics bodies attached), and lots of child nodes which each consist of a circle body. The circles are connected to each other using an SKPhysicsJointPin between each…
Robert
  • 5,735
  • 3
  • 40
  • 53
6
votes
2 answers

How to connect two SKSpriteNode's using SKPhysicsJointPin - swift

I am trying to connect two SKSpriteNode's using SKPhysicsJointPin at anchorPoint marked as green dot on screenshot below. Later I would like enable physicsBody!.dynamic = true on object2 to get "swing animation" of object2. I am having difficulty…
Omen
  • 139
  • 2
  • 13
6
votes
1 answer

SKPhysics: Made a rope, why does it break?

I've been experimenting with sprite kit a little bit, building a prototype for an idea I have. I've been connecting a string of physics bodies together using an SKPhysicsJointPin, to make a rope (actually more like a bike chain, but it's good…
Emiel
  • 1,474
  • 1
  • 13
  • 16
4
votes
2 answers

SKPhysicsJointSpring frequency & damping in Swift

What is the difference between damping and frequency properties of a SKPhysicsJointSpring ? the code I have is var spring = SKPhysicsJointSpring.jointWithBodyA( body1.physicsBody, bodyB: body2.physicsBody, …
ielyamani
  • 17,807
  • 10
  • 55
  • 90
3
votes
2 answers

Simple pin joint in SpriteKit doesn't work as expected

I'd like to make a pendulum. Starting with an SKScene and everything defaulted, I do the following... - (void)createSceneContents { self.physicsBody = [SKPhysicsBody bodyWithEdgeLoopFromRect:self.view.bounds]; // object 1 is the fulcrum …
user1272965
  • 2,814
  • 8
  • 29
  • 49
3
votes
1 answer

SpriteKit SKPhysicsJointFixed odd behaviour

I am trying to connect together two SKNodes which both have equal size circular physics bodies. They are positioned so as to be touching each other, and I want them to be locked together. From the documentation, it sounds like I want a…
Sam Woolf
  • 81
  • 7
3
votes
0 answers

Implement an elastic rope in SpriteKit

I am working on a simple game that has an elastic rope fixed to the middle of the screen which also has a ball linked to the other end of the rope. By moving your finger across the screen you can move the ball and the idea is being able to fling the…
Tomer Ciucran
  • 199
  • 1
  • 10
3
votes
1 answer

Can SKPhysicsJoints be used in a scrolling SpriteKit game?

This seems to be a major oversight by Apple, but since SKPhysicsJoints have their anchor points set in Scene coordinates, this makes doing any kind of scrolling game impossible. To simulate a camera in SpriteKit you create a WorldNode which contains…
BGreenstone
  • 260
  • 1
  • 11
2
votes
1 answer

SKPhysicsJoint remove connecting line between node

I have this code where I am connecting two nodes, everything working as expected. Question is that I want to remove the connecting blue line between nodes (attached image for ref). How should I do that? //This function creates a player sprite…
2
votes
1 answer

Designing complex objects with SpriteKit Scene Editor

Near as I can tell, there isn’t a way to add physics joints in the scene editor. Is that right? Consider a simple person object with a body, child legs and arms w/ pin joints. If I want to design this person in the scene editor and then…
Dennis
  • 555
  • 8
  • 17
2
votes
2 answers

Scaling a pendulum made with SKSpriteNodes

I've got a working clock with a pendulum, but the swinging arm does not scale correctly. Here's what it looks like before scaling... And then, after scaling... The clock face scales down, and so does the swing arm (the green line), but it looks…
user1272965
  • 2,814
  • 8
  • 29
  • 49
2
votes
1 answer

SKPhysicsJointFixed doesn't keep nodes together while moving one

I've created 2 SKSpriteNodes, and connected them by a SKPhysicsJointFixed, to keep them stuck together. The problem is when I apply a SKAction.move(by:, duration:) to the first, it moves alone. why is that, and how can I move them together? I've…
Fayyouz
  • 682
  • 7
  • 18
2
votes
1 answer

Why does the physics joint stop working if the object will move out of the view?

I have a construction crane that has a joint with an object. The joint works fine if the crane is stationary. But I added the ability for the crane to move left to right and whenever the crane is about to leave the view with the object, the object…
Hedylove
  • 1,724
  • 16
  • 26
1
2 3 4 5