skphysicsbody Questions

8

Solved

I am using bodyWithPolygonFromPath to define the volume of a physics body, and I used http://dazchong.com/spritekit/ to get the paths required. But the path does not seem correct and I wish to see ...
Cartridge asked 19/1, 2014 at 6:5

4

Solved

I did a small test project using the "Hello World" Sprite-kit template where there is an atlas animation composed by these frames: - I want to show this knight and it's animation. I want to set...
Mounts asked 22/12, 2016 at 21:51

6

func didBeginContact(contact: SKPhysicsContact) { if ( contact.bodyA.categoryBitMask & BodyType.shield.rawValue ) == BodyType.shield.rawValue { contact.bodyB.node?.removeFromParent() counte...
Probable asked 15/1, 2015 at 4:4

2

Solved

As far as I'm aware the default for Physics bodies is to bounce off each other when they hit each other until you set their collisionBitMask to an equal number. However, I'm having a huge issue ac...
Miche asked 29/6, 2015 at 7:4

4

I am learning Swift, and as a project I am working on a tile based 2D game similar to super mario where my character will walk and jump on tiles. The latest version of Xcode and Sprite Kit give th...
Grekin asked 4/10, 2016 at 2:25

2

Solved

I use the following function to append physicsbodies on tiles from a SKTileMapNode: static func addPhysicsBody(to tileMap: SKTileMapNode, and tileInfo: String){ let tileSize = tileMap.tileSize...
Impresario asked 5/12, 2017 at 2:16

7

My scene has a bunch of rectangles with physics bodies that are the same size as the rectangle. I like to anchor all of my objects to CGPointZero, however I've noticed when I do that the physicsbod...
Sheepskin asked 18/11, 2013 at 10:14

2

Solved

Below is my "Floor.swift" class below which is basically a bunch of walls. I have objects coming from the top of the screen and once the Floor and SKSpriteNodes collide, I'd like the SKSpriteNode t...
Brenna asked 26/12, 2017 at 23:26

4

Solved

I have been struggling for the past two days to get two SKSpriteNodes to register a collision and evoke didBegin#contact. I've set their bit masks 'categoryBitMask', 'contactTestBitMask' and 'coll...

2

I really need to know how to lock the x axis of an SKSpriteNode and its physicsBody. I need to keep the SKSpriteNode dynamic and affectedByGravity. The node is on a slope, so this is why it's x axi...
Hale asked 2/1, 2017 at 6:51

1

Solved

In the didBegin function below, one of the nodes has a category bit mask of 4294967295. However, this category is never assigned to any node. Here are all the bit masks in use: struct PhysicsCat...
Immortalize asked 29/11, 2016 at 5:3

1

Solved

It is hard to describe in plain text, so I recorded a GIF to demonstrate. https://public.lightpic.info/image/2B1F_582465841.gif I am currently working on a project that requires such effect. Up t...
Conjunctiva asked 11/11, 2016 at 13:21

1

Solved

I am using Xcode 7.3.1, iOS 9.3 and Swift 2. Also tested on simulator and my iPad directly. I have done numerous searches, read 2 books of Spritekit Physics and watched numerous video tutorial as w...
Liriodendron asked 20/9, 2016 at 17:22

2

Solved

I am trying to use collision bit masks and contact test bit masks in Swift, I want two objects not to collide together, so I am doing : firstNode.physicsBody?.collisionBitMask = 0b01 secondNode?.c...
Morrison asked 21/8, 2016 at 12:2

2

Solved

I am trying to keep my SKSpriteNodes moving at a constant speed forever, even after collisions. I have set gravity to 0, friction to 0, and linear and angular dampening to zero, but the Sprites sti...
Sharla asked 10/3, 2015 at 19:33

2

I have an extremely basic polygon that is the texture for a sprite in my game, yet when I try and create a physicsBody from this texture for the sprite I get this error: 2016-06-19 08:25:21.707 Sp...
Vaginate asked 19/6, 2016 at 12:37

3

I have an node in space (no angular dampening, no friction, no gravity) and I apply a torque to it (20 newton meters) over 1 second. It begins to spin and will continue forever. If I apply an inver...
Abiogenetic asked 21/10, 2015 at 17:59

1

I have a SKSpriteNode which has a static body, generated from concave path with edgeChainFromPath. Let's call this node a house. I also have another kind of SKSpriteNodes which have a dynamic squa...
Avie asked 18/5, 2016 at 16:46

1

Solved

Sometimes in my SpriteKit programs, my collisions and contacts (using SKPhysicsBody) don't trigger or work as expected. I think I have set up everything I need, but I am still not getting the...
Krissy asked 12/4, 2016 at 10:40

4

In SpriteKit SKPhysicsBody is it possible to have an object you can pass through but not go back. The idea is their is no collision in one direction so you go through and not go back, like a trap...
Embattle asked 12/2, 2016 at 12:35

5

I have a strange memory leaks when creating Sprite Kit physics bodies with custom shapes. This is how my implementation looks: CGFloat offsetX = self.frame.size.width * self.anchorPoint.x; CGFloat...
Graiggrail asked 22/11, 2013 at 0:48

1

Solved

I have four squares in the middle of my scene set up with various anchor points. When tapped, they move together and come apart depending on what position: func rotate(angle : CGFloat, animated :...
Dubitable asked 3/1, 2016 at 20:25

1

Solved

I want to be able to change a node's physicsBody height when the user swipes downwards, but have not been able to find out how to do this, beside resetting the entire physicsBody. When I original...
Unpin asked 9/7, 2015 at 16:43

2

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 ...
Trainbearer asked 28/8, 2014 at 17:56

1

With help from here I have made a circle body traverse a given path. I have some bodies at some of the path points and have logged contact in didBeginContact. When the body gets in contact with a s...
Wizened asked 1/10, 2015 at 15:51

© 2022 - 2024 — McMap. All rights reserved.