collision-detection

Suggestions for .Net 3D physics engine [closed]

时光毁灭记忆、已成空白 提交于 2019-12-04 03:45:56
I need physics engine to simulate game world on server. I googled for .Net physics engines and they all were released in 2006-2009. So is there any good physics engine that I can use? What I need from engine is box, spheres collisions.. Update: sorry forgot to mention i need 3d engine Update: In case someone will need managed physics engine look at Jitter , it's pure managed and from the developer of JigLibX I've used the very good Newton Game Dynamics via P/Invoke. http://newtondynamics.com/forum/newton.php There's also the well-regarded Bullet Physics engine, but I've never used it directly.

cocos2d sprite collision detection boundingbox

旧时模样 提交于 2019-12-04 02:13:22
问题 I got 2 sprites. I use the boundingbox to check for collision with CGRectIntersectsRect. But it is not working. HBBall and HBpaddle has a CCSprite called image. Init: ball = [[HBBall alloc] init]; ball.position = ccp(150, 50); [self addChild:ball]; [update addObject:ball]; paddle1 = [[HBPaddle alloc] init]; paddle1.position = ccp(50, 160); [self addChild:paddle1]; Update: if (CGRectIntersectsRect([paddle1.image boundingBox], [ball.image boundingBox])) CCLOG(@"ball hit paddle");

Per-pixel collision problem in C#

别来无恙 提交于 2019-12-04 02:01:22
问题 I am writing a small 2d game engine in C# for my own purposes, and it works fine except for the sprite collision detection. I've decided to make it a per-pixel detection (easiest for me to implement), but it is not working the way it's supposed to. The code detects a collision long before it happens. I've examined every component of the detection, but I can't find the problem. The collision detection method: public static bool CheckForCollision(Sprite s1, Sprite s2, bool perpixel) { if(

Detecting Rectangle collision with a Circle

可紊 提交于 2019-12-03 22:44:42
问题 I have a Circle with a center point (Center_X, Center_Y) and I am detecting if a rectangle falls into it's Radius (Radius). How would I be able to perform this task? I have tried using if (X - Center_X)^2 + (Y - Center_Y)^2 < Radius^2: print(1) Then I try to draw a circle to fit over this area: Circle = pygame.draw.circle(Window, Blue, (Center_X, Center_Y), Radius, 0) But it doesn't seem to line up. Is there something I am doing wrong? 回答1: Here's what I was describing in my comments, plus

Collision detection with bitmaps on SurfaceView's canvas in Android

放肆的年华 提交于 2019-12-03 22:15:56
In Android I use a SurfaceView to display a simple 2D game. The bitmaps (.png) with alpha (representing the game objects) are drawn on the canvas. Now I would like to do a simple but accurate collision detection. Checking whether these bitmaps are overlapping is quite easy. But how do I check for collisions when these bitmaps have transparent areas? My challenge is detecting whether two balls collide or not. They fill up the whole bitmap in width and height both but in all four edges, there are transparent areas of course as it's a circle in a square. What is the easiest way to detect

How to fix circle and rectangle overlap in collision response?

旧街凉风 提交于 2019-12-03 21:54:27
Since in the digital world a real collision almost never happens, we will always have a situation where the "colliding" circle overlaps the rectangle. How to put back the circle in the situation where it collides perfectly with the rectangle without overlap? Suppose that the rectangle is stopped (null velocity) and axis-aligned. I would solve this problem with a posteriori approach (in two dimensions). In short I have to solve this equation for t : Where: is a number that answers to the question: how many frames ago did the collision happen perfectly? is the radius of the circle. is the center

Collision/overlap detection of circles in a d3 transition

空扰寡人 提交于 2019-12-03 21:37:28
I'm using d3 to animate a route (path) on a map. When the route reaches a point along the route I'd like to popup some information. Most of my code is based on the following example. http://bl.ocks.org/mbostock/1705868 . I'm really just trying to determine if there is a way to detect when the transitioning circle collides or overlaps any of the stationary circles in this example. You can detect collision in your tween function. Define a collide function to be called from inside the tween function as follows: function collide(node){ var trans = d3.transform(d3.select(node).attr("transform"))

Qt - circles for collision detection

荒凉一梦 提交于 2019-12-03 18:12:03
问题 I've been working on a physics simulation with circles in Qt. Thus far the easiest way to define circles I found is to make a QRect object and then draw the ellipse with that rectangle as a "blueprint". Now I've just got the problem that it paints a circle but the hit box for the hit detection is still a square, which looks rather awkward. I've not been able to find a solution for it thus far and hope to find some help here. QRectF Ball::boundingRect() const { return QRect(0,0,20,20); } void

Detect collision between two objects in Swift

夙愿已清 提交于 2019-12-03 16:40:30
Collision detection is pretty simple in Swift - yet on this particular project, body collision is not triggering the didBeginContact event as usual. Here is my checklist for two bodies colliding (using soldiers and bullets): Add SKPhysicsContactDelegate to the class. set the physicsWorld appropriately, usually: self.physicsWorld.contactDelegate = self Create categories for each group of nodes you will have. E.g. let bulletCategory = 0x1 << 0 Create SKNodes for each bullet and soldier. Give each bullet and soldier a physics body with a matching shape. Set each bullet's categoryBitMask to the

LibGDX - properly using Polygon class

限于喜欢 提交于 2019-12-03 16:34:59
I have created Polygon object to wrap my airplane (size of airplane's TextureRegion is 256x74, but size of this one in a game is 70x20). So: TextureRegion[] texRegsAirplane = TextureRegion.split(textureAirplane, 256, 74); Rectangle bounds = new Rectangle(0, 0, 70, 20); Polygon polygon = new Polygon(new float[]{0,0,bounds.width,0,bounds.width,bounds.height,0,bounds.height,0,0}); After that in my update function I update position of it: public void update(float delta){ Vector2 v = getPosition(); v.add(velocity); polygon.setPosition(v.x, v.y); } Then I render polygon to know where it is: public