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
1
vote
0 answers

Swift Physicsbody pinned and joined not working as expected

I'm trying to create a simple car with SKSpriteNode. Physics and everything works great, except for one tiny thing: when my car lands on the ground from a greater distance the body of the car is pushed down and then goes back to its place. See…
1
vote
1 answer

Adding SKPhysicsJointFixed with proper coordinate

I want to add two physics bodies to another body but I when showsPhysics is ON it looks like that. Here is the code I use // Set anchor point self.anchorPoint = CGPointMake(0.5, 0.5) // setup physics self.physicsWorld.gravity = CGVectorMake( 0.0,…
grape1
  • 759
  • 2
  • 8
  • 19
1
vote
1 answer

Can I set anchor point of SKPhysicsJoint outside node?

Let's say I have two circles respectively at (0,0) and (0,1). I have a SKPhysicsJoint between them and it is working good, now I want to separate them with a distance of 2 on runtime, meaning while physics are working in-game. How can I achieve…
EralpB
  • 1,621
  • 4
  • 23
  • 36
1
vote
0 answers

SKPhysicsJointPin in a side scrolling Swift SpriteKit game

I'm trying to develop a side scrolling game in SpriteKit. My problem is the following: I'm trying to add a rope to my game, but it breaks when I start the game. When I add this rope to a non-scrolling game it works perfectly well. I think the…
Eduard
  • 620
  • 9
  • 21
1
vote
1 answer

Swift SpriteKit SKPhysicsJointPin

I'm trying to implement a rope in Swift SpriteKit and to add physics to it, the position is good for all, but they won't attach, when I hit play they all fall except the first one which is the "holder". Here is my code: // create rope holder …
Eduard
  • 620
  • 9
  • 21
1
vote
1 answer

node.physicsBody.joints downcasting error

The following code gives an error - it appears the physics joints array have the class PKPhysicsJoint. Anyone have any ideas how I can iterate through the joints in Swift? The documentation does say that physicsBody.joints should return an array of…
wakiki
  • 45
  • 4
1
vote
0 answers

SKPhysicsJointLimit creating three anchor points in scene

I am trying to connect two SKSpriteNodes together in a scene with a SKPhysicsJointLimit. One node is not effected by the physics simulation, and the other is. This should result in the motion of a pendulum. However, when an SKPhysicsJointLimit is…
reuclid
  • 11
  • 2
1
vote
1 answer

Rope with pin joints and limits appear compressed, curling up

I have a rope with pin joints between chain rings. It had worked perfectly. I now want to simulate real chain, so I added limits for pin joints as such: pinJoint.upperAngleLimit = CGFloat(M_PI / 6) pinJoint.lowerAngleLimit = CGFloat(-M_PI /…
Simankov
  • 91
  • 11
1
vote
1 answer

SKPhysicsJointPin stretching

I tried the solution posted here but it did not fix the issue. No one is responding to the my requests there since the question has already been marked as answered. I have the player jumping across the screen to grab a rope. The grabbing is…
James Paul Mason
  • 1,051
  • 1
  • 13
  • 27
1
vote
0 answers

Unarchiver Sprite Kit's Physics joints

I'm writing a small game for iPad based on SpriteKit. I have a kind of bottles that contains bubbles and a special container that holds nodes linked to the bubbles with SKPhysicsJointSpring. Then I'm trying to save and restore entire scene using…
1
vote
0 answers

limit the zRotation range of a SKPhysicsJointPin physicsbody without using shouldEnableLimits

Can someone please show me how I would limit the zRotation "it's rotatable range" of an SKPhysicsJointPin physicsbody object from its starting point. I currently have an issue when I use shouldEnableLimits that forces my physicbody object to move…
TF35Lightning
  • 365
  • 3
  • 7
  • 22
1
vote
2 answers

SpriteKit iOS8 different physical behavior

i've noticed different behaviors in Physics, for example: I have coded a rope with many SKSpriteNode and SKPhysicsJointLimit for the chain. At the ends i've attached two SKPhysicsJointSpring to two physics-disabled SKSpriteNode. On iOS7 it works…
pascalbros
  • 16,122
  • 5
  • 23
  • 35
1
vote
1 answer

How to join two SKSpriteNodes using SKPhysicsJointFixed

When I attempt to join two SKSpriteNodes with SKPhysicsJointFixed, they separate as if not connected at all. Nothing I do seems to work. Here's my code... CGPoint position = CGPointMake(100, 100); CGSize size = CGSizeMake(4, 64); SKSpriteNode…
0x141E
  • 12,613
  • 2
  • 41
  • 54
1
vote
0 answers

SKPhysicsJoint is joining at what appears to be incorrect coordinates

In my simple archery game, I have defined an arrow node and a target node with associated physics bodies. When I attempt to join them together using an SKPhysicsJointFixed (I have also tried other types), the behaviour is inaccurate with the joint…
Astirian
  • 63
  • 1
  • 10
0
votes
1 answer

Create a raycast in spritekit

I am building a game using Spritekit and am trying to build a raycast that will connect the player with the point where the player tapped. It will be like a rope that connects the player to the point where he or she tapped. For example if a player…
Edwin123
  • 19
  • 2