SKPhysics body colission

Hello everybody!
im making an ARPG using mainly SkNodes, SkSpriteNodes and SKPhysicBody

i have a SKpriteNode for the characters and i'm trying to get the logic for the atacks, for wich i make a new SkShapeNode with physicsBody and some creeps with SKspriteNode and SkPhysicsBody.
My idea is to check when the atack colides with any creeps and apply some effects.
So far is working right, but the problem is that the atack will overlap with the creeps some times (character is near creep and spawns an atack)
and the creeps will move because of the contact.
Any ideas on how i can trigger an event when some contact happen but without having the objects to move because of the colission?
Thanks!.

Replies

See this article for information about setting up nodes for collision/contact detection: https://developer.apple.com/documentation/spritekit/skphysicsbody/about_collisions_and_contacts

From another thread....


I can't say anything about the fps, but there's definitely something going on with iOS 13 when creating an SKPhysicsBody from a texture. Here's the same game with showsPhysics turned on under iOS 12 and iOS 13:


https://i.imgur.com/vsGZLLz.png

If you have not already, please file a bug report using Feedback Assistant.

I filed a report about two weeks ago. Someone else (maybe from stackoverflow) also told me that they had filed one.



looks fixed in iOS 13.2 🙂

I tried it with 13.2, but new problems. The texture is working correctly in 13.2 when it's not in an atlas, but when it is in an atlas I get "PhysicsBody: Could not create physics body." failures. Looking at the texture in Xcode (11.2 beta 2) for 13.2 shows a very odd preview for the texture, so I thought maybe there was some issue with the atlas from the older Xcode that I was using before. But making a new atlas and putting just the problem-causing textures in that still fails. Using no atlases is not feasible for us, since it blows the number of draws.


Edit: I've worked around the issue by having second copies of those textures for which we need conforming physics bodies and having those not in an atlas. Up to three code paths now, normal (iOS 12), convex-hull-based bodies (iOS 13.0, 13.1), and now based off a copy of the texture (iOS 13.2)... :-/

There seems to be an underlying issue that's related to this other issue I've seen with creating SKPhysicsBodies from images in a texture atlas https://forums.developer.apple.com/thread/115152


BTW I've been seeing the same issue as you guys and logged feedback about it.


There have been various issues with creating SKPhysicsBodies from textures on and off ever since iOS 9. I think that's when they started porting SpriteKit from OpenGL to Metal. After starting out my project with pretty much all of the physics bodies being created from textures, I've been moving towards changing them to be circles or rectangles, and now with this bug replaced the last of them with simple custom polygons. Of course that was okay for me in the context of my project, might not be an option for others. It's a bit frustrating working around features that break with updates.