collision

SpriteKit: Sprites are moving through each other with a physicsBody already set

Deadly 提交于 2019-12-08 04:28:12
问题 So I have created a player who moves tile based and a wall surrounding the map to keep the player on the playground. Both have a physicsBody in them. My guess is, that my movement of the player is not properly and so the player bugs into the walls. Let me just show you my code: So this is the physicsBody of the Player: self.physicsBody!.usesPreciseCollisionDetection = true self.physicsBody!.categoryBitMask = PhysicsCategory.Player self.physicsBody!.contactTestBitMask = PhysicsCategory.House

hash collision and appending data

时光毁灭记忆、已成空白 提交于 2019-12-08 04:11:26
问题 Assume I have two strings (or byte arrays) A and B which both have the same hash (with hash I mean things like MD5 or SHA1). If I concatenate another string behind it, will A+C and B+C have the same hash H' as well? What happens to C+A and C+B? I tested it with MD5 and in all my tests, appending something to the end made the hash the same, but appending at the beginning did not. Is this always true (for all inputs)? Is this true for all (well-known) hash functions? If no, is there a (well

Find every colliding object in C# and Unity3D using OnTriggerStay

大兔子大兔子 提交于 2019-12-08 04:00:26
问题 As a gamer I'd phrase it like this: An AOE-Stun that stuns everyone it hits and then disappears. I have enemy objects with a class "EnemyMovement" attached to it. This class contains a function "Slow". I have a circle that has the class "StunSpell" attached to it. Now I want to call "Slow" once for every enemy object that collides with it. void OnTriggerStay2D(Collider2D other){ if (other.gameObject.tag == "Enemy") { //Here i want to find every gameobject (by tag "Enemy") other.GetComponent

Issue with Terrain Collision using Three.js

一笑奈何 提交于 2019-12-08 03:49:07
问题 I have created a terrain via a heightmap in Three.js and am using mrdoob's misc_controls_pointerlock for collision and movement. However, when I do objects.push(terrainobj); the performance goes down to about 3fps (from around 60) and there is no collision with the terrain. The collision is achieved via rays. How can I get around this? 回答1: If it's just a heightmap you could avoid using ray and do the collision checking right in the bitmap (using canvas and imagedata). You just need to

Collision detection for an arc of a circle

雨燕双飞 提交于 2019-12-08 02:49:26
问题 So how do i implement the collision detection for an arc of a circle? Will i have to use the Box 2d collision or can i do it some other way using Rectangle or stuff like that? BTW I hate box2d because i dont understand most of the things in it, so if there is a solution that excludes the box2d, it will be very much appreciated. The yellow arc keeps on rotating over the black circle. How do i implement collision detection in here? Please help ! Thanks! 回答1: To avoid using Box2D you could

Why is there multiple collision calls Sprite Kit Swift

有些话、适合烂在心里 提交于 2019-12-08 02:21:42
问题 I am building an iOS swift game with collision. The hero is being bombarded by small stars coming from the right side of the screen. Every time a star hits the hero, the score is iterated and the star is removed. But, more than one point is added to the score. Node Set-up: var star = SKSpriteNode(imageNamed: "star") star.size = CGSizeMake(30, 30) star.zPosition = 10 var starPhysicsRect = CGRectMake(star.position.x - star.frame.size.width / 2, star.position.y - star.frame.size.width / 2, star

Collision Normal of two points

青春壹個敷衍的年華 提交于 2019-12-08 00:08:29
问题 I'm trying to calculate the collision normal of two points. I need this for the collision response equations to calculate the new angular and linear velocities. This scenario happens when, for example, the corners of two 2d or 3d boxes collide with each other. What would be their collision normal? I now that in the case of a vertex and face collision the collision normal would be just the normal of the face. 回答1: It is undefined. Technically, the collision normal should be the normal at the

Buggy bouncing balls

我们两清 提交于 2019-12-07 17:23:26
问题 I was making a colliding ball sketch in Processing, and I encountered a weird bug. Despite having a condition for bouncing off of the walls, some balls get stuck to it . I can't find the source of error here. Can someone help? I also realise that there maybe few (a lot) bad coding practices, but I apologise beforehand. I am posting the codes below. 1) Main : https://pastebin.com/hv0H14gZ particle[] elec = new particle[5]; boolean record = false; void setup(){ float x=0,y=0; int i,j; float

Collision between multiple objects

强颜欢笑 提交于 2019-12-07 07:39:08
问题 I'm writing a simple physics system for fun, and I've run into a problem that has me stuck. The basic algorithm now is: Move an object Check for collisions If there was a collision Move the object the minimum distance to resolve the collision. Adjust the velocity based on the normals, masses, etc I have one moving body moving toward two, static, massless, bodies. The moving object is translated in one step to collide with one of the bodies. I respond by finding the smallest distance I can

2d Ball Collision Problem: no conservation of energy

烂漫一生 提交于 2019-12-07 07:28:48
问题 I am trying to write a simple physics simulation where balls with varying radii and masses bounce around in a perfectly elastic and frictionless environment. I wrote my own code following this resource: http://www.vobarian.com/collisions/2dcollisions2.pdf and I also tested the code from here: Ball to Ball Collision - Detection and Handling QUESTION EDITED With the help of Rick Goldstein and Ralph, I have gotten my code to work (there was a typo..). Thanks so much for you help. However I am