Search Results

Search found 1655 results on 67 pages for 'detection'.

Page 11/67 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Boat passing under a bridge in a 2D tile based RTS

    - by aleguna
    I'm writing a 2D tile based RTS. And I want to add a 'pseudo 3D' feature to it - bridges over the rivers. I havent't start any coding yet, just trying to think how it fits the collision detection model. A boat passing under the bridge and a unit moving over the bridge will eventually occupy the same cell on the map. How to prement them from colliding? Is there a common approach to solve such a problem? Or I need to implement a 3D world to do this?

    Read the article

  • Pixel perfect collision with paths (Android)

    - by keysersoze
    Hi I'm writing a game and I'm trying to do some pixel perfect collisions with paths. The player's character has a bitmask which looks for example like this: Currenly my code that handles player's collision with path looks like this: private boolean isTerrainCollisionDetected() { if(collisionRegion.op(player.getBounds(), terrain.getBottomPathBounds(), Region.Op.INTERSECT) || collisionRegion.op(player.getBounds(), terrain.getTopPathBounds(), Region.Op.INTERSECT)) { collisionRegion.getBounds(collisionRect); for(int i = collisionRect.left; i < collisionRect.right; i++) { for(int j = collisionRect.top; j < collisionRect.bottom; j++) { if(player.getBitmask().getPixel(i - player.getX(), j - player.getY()) != Color.TRANSPARENT) { return true; } } } } return false; } The problem is that collisions aren't pixel perfect. It detects collisions in situations like this: The question is: what can I do to improve my collision detection?

    Read the article

  • most efficient AABB vs Ray collision algorithms

    - by Asher Einhorn
    Is there a known 'most efficient' algorithm for AABB vs Ray collision detection? I recently stumbled accross Arvo's AABB vs Sphere collision algorithm, and I am wondering if there is a similarly noteworthy algorithm for this. One must have condition for this algorithm is that I need to have the option of querying the result for the distance from the ray's origin to the point of collision. having said this, if there is another, faster algorithm which does not return distance, then in addition to posting one that does, also posting that algorithm would be very helpful indeed. Please also state what the function's return argument is, and how you use it to return distance or a 'no-collision' case. For example, does it have an out parameter for the distance as well as a bool return value? or does it simply return a float with the distance, vs a value of -1 for no collision? (For those that don't know: AABB = Axis Aligned Bounding Box)

    Read the article

  • How are trajectories calculated and transmitted to other players in Multi-Player ?

    - by giulio
    I play alot of COD4. And can see tracers for gunfire, missles, care packages fall from helicopters etc. There is alot of activity. I am curious to know the algorithm (at a high level) that manages all this action when you have 20 people on a map shooting each other to death ? This question touches on the subject but doesn't ask for a more in-depth answer as to how you the developers go about calculating and transmitting movement and collision detection for projectiles, be it missles/bullets or any other object that is flying through the air in real-time.

    Read the article

  • Trouble with AABB collision response and physics

    - by WCM
    I have been racking my brain trying to figure out a problem I am having with physics and basic AABB collision response. I am fairly close as the physics are mostly right. Gravity feels good and movement is solid. The issue I am running into is that when I land on the test block in my project, I can jump off of it most of the time. If I repeatedly jump in place, I will eventually get stuck one or two pixels below the surface of the test block. If I try to jump, I can become free of the other block, but it will happen again a few jumps later. I feel like I am missing something really obvious with this. I have two functions that support the detection and function to return a vector for the overlap of the two rectangle bounding boxes. I have a single update method that is processing the physics and collision for the entity. I feel like I am missing something very simple, like an ordering of the physics vs. collision response handling. Any thoughts or help can be appreciated. I apologize for the format of the code, tis prototype code mostly. The collision detection function: public static bool Collides(Rectangle source, Rectangle target) { if (source.Right < target.Left || source.Bottom < target.Top || source.Left > target.Right || source.Top > target.Bottom) { return false; } return true; } The overlap function: public static Vector2 GetMinimumTranslation(Rectangle source, Rectangle target) { Vector2 mtd = new Vector2(); Vector2 amin = source.Min(); Vector2 amax = source.Max(); Vector2 bmin = target.Min(); Vector2 bmax = target.Max(); float left = (bmin.X - amax.X); float right = (bmax.X - amin.X); float top = (bmin.Y - amax.Y); float bottom = (bmax.Y - amin.Y); if (left > 0 || right < 0) return Vector2.Zero; if (top > 0 || bottom < 0) return Vector2.Zero; if (Math.Abs(left) < right) mtd.X = left; else mtd.X = right; if (Math.Abs(top) < bottom) mtd.Y = top; else mtd.Y = bottom; // 0 the axis with the largest mtd value. if (Math.Abs(mtd.X) < Math.Abs(mtd.Y)) mtd.Y = 0; else mtd.X = 0; return mtd; } The update routine (gravity = 0.001f, jumpHeight = 0.35f, moveAmount = 0.15f): public void Update(GameTime gameTime) { Acceleration.Y = gravity; Position += new Vector2((float)(movement * moveAmount * gameTime.ElapsedGameTime.TotalMilliseconds), (float)(Velocity.Y * gameTime.ElapsedGameTime.TotalMilliseconds)); Velocity.Y += Acceleration.Y; Vector2 previousPosition = new Vector2((int)Position.X, (int)Position.Y); KeyboardState keyboard = Keyboard.GetState(); movement = 0; if (keyboard.IsKeyDown(Keys.Left)) { movement -= 1; } if (keyboard.IsKeyDown(Keys.Right)) { movement += 1; } if (Position.Y + 16 > GameClass.Instance.GraphicsDevice.Viewport.Height) { Velocity.Y = 0; Position = new Vector2(Position.X, GameClass.Instance.GraphicsDevice.Viewport.Height - 16); IsOnSurface = true; } if (Collision.Collides(BoundingBox, GameClass.Instance.block.BoundingBox)) { Vector2 mtd = Collision.GetMinimumTranslation(BoundingBox, GameClass.Instance.block.BoundingBox); Position += mtd; Velocity.Y = 0; IsOnSurface = true; } if (keyboard.IsKeyDown(Keys.Space) && !previousKeyboard.IsKeyDown(Keys.Space)) { if (IsOnSurface) { Velocity.Y = -jumpHeight; IsOnSurface = false; } } previousKeyboard = keyboard; } This is also a full download to the project. https://www.box.com/s/3rkdtbso3xgfgc2asawy P.S. I know that I could do this with the XNA Platformer Starter Kit algo, but it has some deep flaws that I am going to try to live without. I'd rather go the route of collision response via an overlay function. Thanks for any and all insight!

    Read the article

  • Circle physics and collision using vectors

    - by Joe Hearty
    This is a problem I've been having, When making a set number of filled circles at random locations on a JPanel and applying a gravity (a negative change in the y), each of the circles collide. I want them to have collision detection and push in the opposite direction using vectors but I don't know how to apply that to my scenario could someone help? public void drawballs(Graphics g){ g.setColor (Color.white); //displays circles for(int i = 0; i<xlocationofcircles.length-1; i++){ g.fillOval( (int) xlocationofcircles[i], (int) (ylocationofcircles[i]) ,16 ,16 ); ylocationofcircles[i]+=.2; //gravity if(ylocationofcircles[i] > 550) //stops gravity at bottom of screen ylocationofcircles[i]-=.2; //Check distance between circles(i think..) float distance =(xlocationofcircles[i+1]-xlocationofcircles[i]) + (ylocationofcircles[i+1]-xlocationofcircles[i]); if( Math.sqrt(distance) <16) ...

    Read the article

  • How to avoid circular dependencies between Player and World?

    - by futlib
    I'm working on a 2D game where you can move up, down, left and right. I have essentially two game logic objects: Player: Has a position relative to the world World: Draws the map and the player So far, World depends on Player (i.e. has a reference to it), needing its position to figure out where to draw the player character, and which portion of the map to draw. Now I want to add collision detection to make it impossible for the player to move through walls. The simplest way I can think of is to have the Player ask the World if the intended movement is possible. But that would introduce a circular dependency between Player and World (i.e. each holds a reference to the other), which seems worth avoiding. The only way I came up with is to have the World move the Player, but I find that somewhat unintuitive. What is my best option? Or is avoiding a circular dependency not worth it?

    Read the article

  • How should I choose quadtree depth?

    - by Evpok
    I'm using a quadtree to prune collision detection pairs in a 2d world. How should I choose to what depth said quadtree is calculated? The world is made mostly of moving objects1, so the cost of dispatching the objects between the quadtree cells matters. What is the relationship between the gain from less collision checking and the loss from more dispatching? How can I strike a balance that performs optimally? 1 To be completely explicit, they are autonomous self-replicating cells competing for food sources. This is an attempt to show my pupils predator-prey dynamics and genetic evolution at work.

    Read the article

  • Detecting pixels in a rotated Texture2D in XNA?

    - by PugWrath
    I know things similar to this have been posted, but I'm still trying to find a good solution... I'm drawing Texture2D objects on the ground in my game, and for Mouse-Over or targeting methods, I'm detecting whether or not the pixel in that Texture at the mouse position is Color.Transparent. This works perfectly when I do not rotate the texture, but I'd like to be able to rotate textures to add realism/variety. However, I either need to create a new Texture2D that is rotated at the correct angle so that I can detect its pixels, or I need to find some other method of detection... Any thoughts?

    Read the article

  • Detailed Modern Opengl Tutorial?

    - by Kogesho
    I am asking for a specific modern opengl tutorial. I need a tutorial that does not skip to explain any lines of code. It should also include different independent objects moving/rotating (most tutorials use only one object), as well as imported 3d objects and collision detection for them. It should also avoid stuff that won't be used. Arcysnthesis for example gives a new concept, and after teaching it, in the next tutorial, it explains how bad it is for performance and introduces another method. Do you know any?

    Read the article

  • Collision representation in game overworlds

    - by Akroy
    I'm implementing a 2D overworld where one can walk through an area that is not tile based. I was wondering the best way to implement collisions. In the past when I've done similar things, I've used one image (or set of images) to show an elaborately drawn world and then a second binary image that does nothing but differentiate "wall" and "not wall". Then, I'd use the first for all drawing to the screen, but the second for collision detection. Having another image of the same size to represent collisions seems like lots of overhead. Is there a better way to handle this? (I'm currently using C++ with SDL, although I'm more interested in general concepts)

    Read the article

  • How to determine collision direction between two rectangles?

    - by Jon
    I am trying to figure out how to determine the direction a collision occurs between two rectangles. One rectangle does not move. The other rectangle has a velocity in any direction. When a collision occurs, I want to be able to set the position of the moving rectangle to the point of impact. I seem to be stuck in determining from what direction the impact occurs. If I am moving strictly vertically or horizontally I manage great detection. But when moving in both directions at the same time, strange things happen. What is the best way to determine what direction a collision occurs between two rectangles?

    Read the article

  • XNA 2D Rotated Rectangle Collision Response

    - by Kyle Uithoven
    I am using Rotated Rectangles which collide using the Separating Axis Theorem and they work perfectly fine for collision detection using Intersects and Contains. However, I am starting to use faster objects in my game now and there is the issue of the two object overlapping during collision due to their higher velocities. I would like to do a collision response where I find out how much they are overlapping in the X and Y and put position them outside of each other. I would like to use something like this: http://go.colorize.net/xna/2d_collision_response_xna/index.html. But I am having some issues trying to adapt this to handle the rotation of the bounds. Is this possible? Are there any resources out there that I can look at?

    Read the article

  • Vectors with Circles Physics -java

    - by Joe Hearty
    This is a problem I've been having, When making a set number of filled circles at random locations on a JPanel and applying a gravity (a negative change in the y), each of the circles collide. I want them to have collision detection and push in the opposite direction using vectors but i don't know how to apply that to my scenario could someone help? public void drawballs(Graphics g){ g.setColor (Color.white); //displays circles for(int i = 0; i<xlocationofcircles.length-1; i++){ g.fillOval( (int) xlocationofcircles[i], (int) (ylocationofcircles[i]) ,16 ,16 ); ylocationofcircles[i]+=.2; //gravity if(ylocationofcircles[i] > 550) //stops gravity at bottom of screen ylocationofcircles[i]-=.2; //Check distance between circles(i think..) float distance =(xlocationofcircles[i+1]-xlocationofcircles[i]) + (ylocationofcircles[i+1]-xlocationofcircles[i]) ; if( Math.sqrt(distance) <16)

    Read the article

  • Edge Detection on Screen

    - by user2056745
    I have a edge collision problem with a simple game that i am developing. Its about throwing a coin across the screen. I am using the code below to detect edge collisions so i can make the coin bounce from the edges of the screen. Everything works as i want except one case. When the coin hits left edge and goes to right edge the system doesnt detect the collision. The rest cases are working perfectly, like hitting the right edge first and then the left edge. Can someone suggest a solution for it? public void onMove(float dx, float dy) { coinX += dx; coinY += dy; if (coinX > rightBorder) { coinX = ((rightBorder - coinX) / 3) + rightBorder; } if (coinX < leftBorder) { coinX = -(coinX) / 3; } if (coinY > bottomBorder) { coinY = ((bottomBorder - coinY) / 3) + bottomBorder; } invalidate(); }

    Read the article

  • Apache (XAMPP 1.8.0) access.log/Intrusion Detection Concern

    - by Andy Holaday
    [I originally posted on SO but it earned me a Tumbleweed badge. This looks like a better venue for the question.] I have Apache (XAMPP 1.8.0) running on Vista Pro x64. A couple times now I have seen a pattern like the example below in access.log. Concerning is the "attack" seems to somehow shift from a public IP to a valid private IP on my network (happens to be the WAN address of one of my routers). Two questions: How is this possible, and what happens if the "attacker" stumbles on a valid request? I've googled this to no avail. 177.0.X.X - - [03/Jun/2012:08:19:34 -0400] "GET /phpMyAdmin-2.5.4/index.php HTTP/1.1" 403 177.0.X.X - - [03/Jun/2012:08:19:34 -0400] "GET /phpMyAdmin-2.5.5-rc1/index.php HTTP/1.1" 403 177.0.X.X - - [03/Jun/2012:08:19:34 -0400] "GET /phpMyAdmin-2.2.6/index.php HTTP/1.1" 403 177.0.X.X - - [03/Jun/2012:08:19:34 -0400] "GET /phpMyAdmin-2.5.5-rc2/index.php HTTP/1.1" 403 192.168.15.3 - - [03/Jun/2012:08:19:56 -0400] "GET /phpMyAdmin-2.5.6-rc2/index.php HTTP/1.1" 403 177.0.X.X - - [03/Jun/2012:08:19:56 -0400] "GET /phpMyAdmin-2.5.6-rc1/index.php HTTP/1.1" 403 177.0.X.X - - [03/Jun/2012:08:19:56 -0400] "GET /phpMyAdmin-2.5.5-pl1/index.php HTTP/1.1" 403 192.168.15.3 - - [03/Jun/2012:08:19:59 -0400] "GET /phpMyAdmin-2.5.7/index.php HTTP/1.1" 403 192.168.15.3 - - [03/Jun/2012:08:20:01 -0400] "GET /phpMyAdmin-2.5.7-pl1/index.php HTTP/1.1" 403 192.168.15.3 - - [03/Jun/2012:08:20:02 -0400] "GET HTTP/1.1" 400 1060 "-" "-"

    Read the article

  • Collision detection when pathfinding with pathnodes, UDK

    - by Dave Voyles
    I'm trying to create a class that allows my AIController to path find using pathnodes (NOT NavMeshes). It's doing a swell job of going from point to point in a set order (although I would like for it to be a random patrol at some point), but it gets caught up on collision from time to time. I.E. He'll walk the same set path, and when he runs into the blocks in the middle of the map he continues to rub against them until they finish, and continues on his merry way to the next path node. How can I prevent this from happening, or at least have him move from the wall if he does a trace and detects that it is there? It looks like I need to use MoveToward() instead of MoveTo(), as MoveToward allows the pawn to adjust its course during movement. I'm just not sure of how to use those paramters. Mougli has a decent tutorial on it[/URL], but I can't seem to get it to work correctly with my pathnode array. class PathfindingAIController extends UDKBot; var array Waypoints; var int _PathNode; //declare it at the start so you can use it throughout the script var int CloseEnough; simulated function PostBeginPlay() { local PathNode Current; super.PostBeginPlay(); //add the pathnodes to the array foreach WorldInfo.AllActors(class'Pathnode',Current) { Waypoints.AddItem( Current ); } } simulated function Tick(float DeltaTime) { local int Distance; local Rotator DesiredRotation; super.Tick(DeltaTime); if (Pawn != None) { // Smoothly rotate the pawn towards the focal point DesiredRotation = Rotator(GetFocalPoint() - Pawn.Location); Pawn.FaceRotation(RLerp(Pawn.Rotation, DesiredRotation, 3.125f * DeltaTime, true), DeltaTime); } Distance = VSize2D(Pawn.Location - Waypoints[_PathNode].Location); if (Distance <= CloseEnough) { _PathNode++; } if (_PathNode >= Waypoints.Length) { _PathNode = 0; } GoToState('Pathfinding'); } auto state Pathfinding { Begin: if (Waypoints[_PathNode] != None) // make sure there is a pathnode to move to { MoveTo(Waypoints[_PathNode].Location); //move to it `log("STATE: Pathfinding"); } } DefaultProperties { CloseEnough=400 bIsplayer = True }

    Read the article

  • Performance issues with visibility detection and object transparency

    - by maul
    I'm working on a 3d game that has a view similar to classic isometric games (diablo, etc.). One of the things I'm trying to implement is the effect of turning walls transparent when the player walks behind them. By itself this is not a huge issue, but I'm having trouble determining which walls should be transparent exactly. I can't use a circle or square mask. There are a lot of cases where the wall piece at the same (relative) position has different visibility depending on the surrounding area. With the help of a friend I came up with this algorithm: Create a grid around the player that contains a lot of "visibility points" (my game is semi tile-based so I create one point for every tile on the grid) - the size of the square's side is close to the radius where I make objects transparent. I found 6x6 to be a good value, so that's 36 visibility points total. For every visibility point on the grid, check if that point is in the player's line of sight. For every visibility point that is in the LOS, cast a ray from the camera to that point and mark all objects the ray hits as transparent. This algorithm works - not perfectly, but only requires some tuning - however this is very slow. As you can see, it requries 36 ray casts minimum, but most of the time 60-70 depending on the position. That's simply too much for the CPU. Is there a better way to do this? I'm using Unity 3D but I'm not looking for an engine-specific solution.

    Read the article

  • How to connect Ethernet on Ubuntu (with auto-detection)

    - by user12285
    It's been well over six months but I have the same router SmartAX MT880d with Ethernet, and the exact same problem : no internet, even though I can successfully reach the modem settings page by entering 192.168.1.1 in Firefox. I'm a total beginner with Ubuntu. My internet works great in Windows but does not work in Ubuntu. Sorry if I don't use the right (technical) terminology to explain my issue. English is not my mother tongue. For 2 weeks, I've been doing reading on the web and forums and the ubuntuguide.org to name a few, but to no avail. Now I see no other solution but to ask for help. My problem is that I can't find a way to put the right digits in the right place because I don't know what numbers I need to put in what files. E.g.: do I need to use DHCP? or a static IP address? No clue whatsoever. I'm concerned that I might put figures in the wrong spaces. For example, is the modem/router's IP exactly 192.168.1.1 for Huawei Smart AXMT880d modem? Is the subnet 255.255.255.0? Gateway 192.168.1.1? I'm confused as I can also see a different IP starting with 155131*** (is it an account number?) on my contract with Huawei (a Chinese ISP). Apart from calling 911, what other numbers do I need to put in and where? How do I check that all the numbers have been entered correctly in every appropriate space before trying to connect the Internet?

    Read the article

  • Object detection in bitmap JavaScript canvas

    - by fallenAngel
    I want to detect clicks on canvas elements which are drawn using paths. So far I have stored element paths in a JavaScript data structure and then check the coordinates of hits which match the element's coordinates. Rendering each element path and checking the hits would be inefficient when there are a lot of elements. I believe there must be an algorithm for this kind of coordinate search, can anyone help me with this?

    Read the article

  • Mobile phone detection (brand, model, browser etc)

    - by SyaZ
    What do you use to detect visitor's mobile phone, down to the model if possible? Currently we maintain our own database but it's really getting behind due to lack of manpower to maintain it, so we decided to give 3rd party solution a try. These are my candidates but I don't have time to really try them all: DeviceAtlas - 1 year personal evaluation, but basic license is affordable. Their database look solid with daily update and user-contributed tests / updates. I am favoring this one at the moment. DetectRight - I was recommended this by a colleague but really can't find much from their site. 20k devices -- really? WURFL - Open source, database collaboratively derived from UAProf. So basically if you're going with UAProf solution, you're better off with WURFL. DetectMoBileBrowsers - This looks like the simplest of all. Too bad it's language dependent (PHP). Please share your experience or suggestions!

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >