Search Results

Search found 15196 results on 608 pages for 'browser detection'.

Page 3/608 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Open a new browser window, or set focus to an existing browser

    - by Craig Myles
    Hi, I'm using code similar to the following: http://blog.flexexamples.com/2007/08/29/launching-new-browser-windows-from-flex/ I have a Flex app running in AIR, and when I click on a URL it opens a new tab in my existing browser. In addition to this the focus doesn't set to the browser. What this means is that I'm not aware of the URL opening in the browser unless I actually change focus from the app to the browser. Is it possible to open a brand new spanking browser, or change focus to the browser so its really obvious to the user? Thanks.

    Read the article

  • Collision Detection Game Design and Architecture

    - by Chompas
    I've reading some articles about collision detection. My question here is about ideas on the design for it. Baically I have a C++ game that has a main loop with entities with an update method. Based on keyboard input, these characters updates their positions. My question is not about how to detect collisions, it's about getting ideas in which is the best way to implement this. The game has a main character but also enemies that have to collide between them, so I'm not sure where to make all the iterations for checking collisions and if the right way is to check everything against everything. Thanks in advance.

    Read the article

  • Collision detection of convex shapes on voxel terrain

    - by Dave
    I have some standard convex shapes (cubes, capsules) on a voxel terrain. It is very easy to detect single vertex collisions. However, it becomes computationally expensive when many vertices are involved. To clarify, currently my algorithm represents a cube as multiple vertices covering every face of the cube, not just the corners. This is because the cubes can be much bigger than the voxels, so multiple sample points (vertices) are required (the distance between sample points must be at least the width of a voxel). This very rapidly becomes intractable. It would be great if there were some standard algorithm(s) for collision detection between convex shapes and arbitrary voxel based terrain (like there is with OBB's and seperating axis theorem etc). Any help much appreciated.

    Read the article

  • Narrow-phase collision detection algorithms

    - by Marian Ivanov
    There are three phases of collision detection. Broadphase: It loops between all objecs that can interact, false positives are allowed, if it would speed up the loop. Narrowphase: Determines whether they collide, and sometimes, how, no false positives Resolution: Resolves the collision. The question I'm asking is about the narrowphase. There are multiple algorithms, differing in complexity and accuracy. Hitbox intersection: This is an a-posteriori algorithm, that has the lowest complexity, but also isn't too accurate, Color intersection: Hitbox intersection for each pixel, a-posteriori, pixel-perfect, not accuratee in regards to time, higher complexity Separating axis theorem: This is used more often, accurate for triangles, however, a-posteriori, as it can't find the edge, when taking last frame in account, it's more stable Linear raycasting: A-priori algorithm, useful for semi-realistic-looking physics, finds the intersection point, even more accurate than SAT, but with more complexity Spline interpolation: A-priori, even more accurate than linear rays, even more coplexity. There are probably many more that I've forgot about. The question is, in when is it better to use SAT, when rays, when splines, and whether there is anything better.

    Read the article

  • Collision detection with heightmap based terrain

    - by Truman's world
    I am developing a 2D tank game. The terrain is generated by Midpoint Displacement Algorithm, so the terrain is represented by an array: index ---> height of terrain [0] ---> 5 [1] ---> 8 [2] ---> 4 [3] ---> 6 [4] ---> 8 [5] ---> 9 ... ... The rendered mountain looks like this: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 0 1 2 3 4 5 ... I want tanks to be able to move smoothly on the terrain (I mean tanks can rotate according to the height when they move), but the surface of the terrain is not flat, it is polygonal. Can anyone give me some help with collision detection in this situation? Thanks in advance.

    Read the article

  • Typical collision detection

    - by marcg11
    I would like to know how is the typical collision detection of most games. For example, you control a character which can move in 2 dimensional directions (except up and down). Now lets asume he walks into a wall, most of the games depending on character angle and the BB normal face will only stop the player in one axis, but will continue moving in the other along the wall axis. How is that done? I've only managed to stop the character from going through the wall by seting the position to the last one in the past frame if the new position colllisions the bounding box. But this just makes the player stop sharply and unrealisticly.

    Read the article

  • Collision detection with entities/AI

    - by James Williams
    I'm making my first game in Java, a top down 2D RPG. I've handled basic collision detection, rendering and have added an NPC, but I'm stuck on how to handle interaction between the player and the NPC. Currently I'm drawing out my level and then drawing characters, NPCs and animated tiles on top of this. The problem is keeping track of the NPCs so that my Character class can interact with methods in the NPC classes on collision. I'm not sure my method of drawing the level and drawing everything else on top is a good one - can anyone shed any light on this topic?

    Read the article

  • Continuous Collision Detection Techniques

    - by Griffin
    I know there are quite a few continuous collision detection algorithms out there , but I can't find a list or summary of different 2D techniques; only tutorials on specific algorithms. What techniques are out there for calculating when different 2D bodies will collide and what are the advantages / disadvantages of each? I say techniques and not algorithms because I have not yet decided on how I will store different polygons which might be concave or even have holes. I plan to make a decision on this based on what the algorithm requires (for instance if an algorithm breaks down a polygon into triangles or convex shapes I will simply store the polygon data in this form).

    Read the article

  • Making an efficient collision detection system

    - by Sri Harsha Chilakapati
    I'm very new to game development (just started 3 months ago) and I'm learning through creating a game engine. It's located here. In terms of collision, I know only brute-force detection, in which case, the game slows down if there are a number of objects. So my question is How should I program the collisions? I want them to happen automatically for every object and call the object's collision(GObject other) method on each collision. Are there any new algorithms which can make this fast? If so, can anybody shed some light on this topic?

    Read the article

  • Making a collision detection system

    - by Sri Harsha Chilakapati
    I'm very new to game development (just started 3 months ago) and I've learning through creating a game engine. It's located here. In terms of collision, I know only brutefoce detection, in which case, the game slows down if there are a number of objects. So my question is How should I program the collisions? I want them to happen automatically for every object and call the object's collision(GObject other) method on each collision. Are there any new algorithms which can make this fast? If so, can anybody6 sh6ed some light on this topic? And I think of making it like the game maker Thanks

    Read the article

  • Circle vs Edge collision detection / resolution

    - by topheman
    I made a javascript class Ball.js that handles physics interactions betweens balls as well as painting. In the v1.0, the ball vs ball collision detection and resolution is well handled. In the next version (v2), I'm trying to add edgeCollision handling. I'm having some problems, maybe you will be able to help me. All the v2 branch source code is on github repository : https://github.com/topheman/Ball.js/tree/v2 The v2 demos (where you can see the bug I will be talking about) : http://labs.topheman.com/Ball-v2/#help As you will see on the demo, I have two major problems that I'm having a really hard time to solve on Ball.js : method resolveEdgeCollision : bounce angle is inconsistent method checkEdgeCollision : if the ball's velocity (the length that it runs each frame) is higher than its diameter, eventually, it will pass through an edge, without triggering any collision Any Ideas ?...

    Read the article

  • Collision detection in multiplayer games

    - by Bane
    This a followup to my previous question: How to implement physics and AoE spells in an MMO game?. There, we concluded that all physics have to be done on the server, and that I should use cylinders for calculations. Now, how can I check for collision detection on a ground-to-player basis on the server? It's fairly easy if the ground is a flat space, I just check if the player's z coordinate is lower than some value and voila, but, what if the map/ground itself is a model? How do I know where hills are on the server-side? How do I know when object collisions happen? I'm using node.js and socket.io.

    Read the article

  • Fixing a collision detection bug in Slick2D

    - by Jesse Prescott
    My game has a bug with collision detection. If you go against the wall and tap forward/back sometimes the game thinks the speed you travelled at is 0 and the game doesn't know how to get you out of the wall. My collision detection works by getting the speed you hit the wall at and if it is positive it moves you back, if it is negative it moves you forward. It might help if you download it: https://rapidshare.com/files/1550046269/game.zip Sorry if I explained badly, it's hard to explain. float maxSpeed = 0.3f; float minSpeed = -0.2f; float acceleration = 0.002f; float deacceleration = 0.001f; float slowdownSpeed = 0.002f; float rotateSpeed = 0.08f; static float currentSpeed = 0; boolean up = false; boolean down = false; boolean noKey = false; static float rotate = 0; //Image effect system static String locationCarNormal; static String locationCarFront; static String locationCarBack; static String locationCarBoth; static boolean carFront = false; static boolean carBack = false; static String imageRef; boolean collision = false; public ComponentPlayerMovement(String id, String ScarNormal, String ScarFront, String ScarBack, String ScarBoth) { this.id = id; playerBody = new Rectangle(900/2-16, 700/2-16, 32, 32); locationCarNormal = ScarNormal; locationCarFront = ScarFront; locationCarBack = ScarBack; locationCarBoth = ScarBoth; imageRef = locationCarNormal; } @Override public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException { Input input = gc.getInput(); playerBody.transform(Transform.createRotateTransform(2)); float hip = currentSpeed * delta; float unstuckspeed = 0.05f * delta; if(carBack && !carFront) { imageRef = locationCarBack; ComponentImageRender.updateImage(); } else if(carFront && !carBack) { imageRef = locationCarFront; ComponentImageRender.updateImage(); } else if(carFront && carBack) { imageRef = locationCarBoth; ComponentImageRender.updateImage(); } if(input.isKeyDown(Input.KEY_RIGHT)) { rotate += rotateSpeed * delta; owner.setRotation(rotate); } if(input.isKeyDown(Input.KEY_LEFT)) { rotate -= rotateSpeed * delta; owner.setRotation(rotate); } if(input.isKeyDown(Input.KEY_UP)) { if(!collision) { up = true; noKey = false; if(currentSpeed < maxSpeed) { currentSpeed += acceleration; } MapCoordStorage.mapX += hip * Math.sin(Math.toRadians(rotate)); MapCoordStorage.mapY -= hip * Math.cos(Math.toRadians(rotate)); } else { currentSpeed = 1; } } else if(input.isKeyDown(Input.KEY_DOWN) && !collision) { down = true; noKey = false; if(currentSpeed > minSpeed) { currentSpeed -= slowdownSpeed; } MapCoordStorage.mapX += hip * Math.sin(Math.toRadians(rotate)); MapCoordStorage.mapY -= hip * Math.cos(Math.toRadians(rotate)); } else { noKey = true; if(currentSpeed > 0) { currentSpeed -= deacceleration; } else if(currentSpeed < 0) { currentSpeed += acceleration; } MapCoordStorage.mapX += hip * Math.sin(Math.toRadians(rotate)); MapCoordStorage.mapY -= hip * Math.cos(Math.toRadians(rotate)); } if(entityCollisionWith()) { collision = true; if(currentSpeed > 0 || up) { up = true; currentSpeed = 0; carFront = true; MapCoordStorage.mapX += unstuckspeed * Math.sin(Math.toRadians(rotate-180)); MapCoordStorage.mapY -= unstuckspeed * Math.cos(Math.toRadians(rotate-180)); } else if(currentSpeed < 0 || down) { down = true; currentSpeed = 0; carBack = true; MapCoordStorage.mapX += unstuckspeed * Math.sin(Math.toRadians(rotate)); MapCoordStorage.mapY -= unstuckspeed * Math.cos(Math.toRadians(rotate)); } else { currentSpeed = 0; } } else { collision = false; up = false; down = false; } if(currentSpeed >= -0.01f && currentSpeed <= 0.01f && noKey && !collision) { currentSpeed = 0; } } public static boolean entityCollisionWith() throws SlickException { for (int i = 0; i < BlockMap.entities.size(); i++) { Block entity1 = (Block) BlockMap.entities.get(i); if (playerBody.intersects(entity1.poly)) { return true; } } return false; } }

    Read the article

  • Color based collision detection

    - by user1486826
    I am making a game where you fly a ship around some randomly generated planets. Since I am using a for loop to draw over 5000 planets, using the rectangle class or an oval-type class for this is not an option, since creating many objects will severely affect performance. Bitmasking each planet will likely result in performance issues too, so the only candidate is color based collision detection, because I don't need to apply some sort of object to everything I want to check for collisions. Is any way to check the perimeter around the ship for a certain color?

    Read the article

  • Beat detection, weird detection

    - by Quincy
    I made this soundanalyzer class to detect beats in songs : // put it on pastebin for the big size, will put it here if people rather want that. pastebin.com/8PdgZPP3 but for some reason its only detecting beats from 637 sec to around 641(sec) and I have no idea why. I know the beats are being inserted from multiple bands since I am finding duplicates and it seems as its assigning a beat to each instant energy value in between those values. Its modeled after this : http://www.flipcode.com/misc/BeatDetectionAlgorithms.pdf So why won't the beats properly register ?

    Read the article

  • Browser which supports syntax highlighting

    - by RRUZ
    Does anybody know of some browser or browser addon which supports syntax highlighting when opening a web file like http://gears.googlecode.com/svn/trunk/gears/geolocation/wifi_data_provider_win32.cc http://standardpascal.org/basics.pas Thanks.

    Read the article

  • Continuous Physics Engine's Collision Detection Techniques

    - by Griffin
    I'm working on a purely continuous physics engine, and I need to choose algorithms for broad and narrow phase collision detection. "Purely continuous" means I never do intersection tests, but instead want to find ways to catch every collision before it happens, and put each into "planned collisions" stack that is ordered by TOI. Broad Phase The only continuous broad-phase method I can think of is encasing each body in a circle and testing if each circle will ever overlap another. This seems horribly inefficient however, and lacks any culling. I have no idea what continuous analogs might exist for today's discrete collision culling methods such as quad-trees either. How might I go about preventing inappropriate and pointless broad test's such as a discrete engine does? Narrow Phase I've managed to adapt the narrow SAT to a continuous check rather than discrete, but I'm sure there's other better algorithms out there in papers or sites you guys might have come across. What various fast or accurate algorithm's do you suggest I use and what are the advantages / disatvantages of each? Final Note: I say techniques and not algorithms because I have not yet decided on how I will store different polygons which might be concave, convex, round, or even have holes. I plan to make a decision on this based on what the algorithm requires (for instance if I choose an algorithm that breaks down a polygon into triangles or convex shapes I will simply store the polygon data in this form).

    Read the article

  • Per Pixel Collision Detection

    - by CJ Cohorst
    Just a quick question, I have this collision detection code: public bool PerPixelCollision(Player player, Game1 dog) { Matrix atob = player.Transform * Matrix.Invert(dog.Transform); Vector2 stepX = Vector2.TransformNormal(Vector2.UnitX, atob); Vector2 stepY = Vector2.TransformNormal(Vector2.UnitY, atob); Vector2 iBPos = Vector2.Transform(Vector2.Zero, atob); for(int deltax = 0; deltax < player.playerTexture.Width; deltax++) { Vector2 bpos = iBPos; for (int deltay = 0; deltay < player.playerTexture.Height; deltay++) { int bx = (int)bpos.X; int by = (int)bpos.Y; if (bx >= 0 && bx < dog.dogTexture.Width && by >= 0 && by < dog.dogTexture.Height) { if (player.TextureData[deltax + deltay * player.playerTexture.Width].A > 150 && dog.TextureData[bx + by * dog.Texture.Width].A > 150) { return true; } } bpos += stepY; } iBPos += stepX; } return false; } What I want to know is where to put in the code where something happens. For example, I want to put in player.playerPosition.X -= 200 just as a test, but I don't know where to put it. I tried putting it under the return true and above it, but under it, it said unreachable code, and above it nothing happened. I also tried putting it by bpos += stepY; but that didn't work either. Where do I put the code? Any help is appreciated. Thanks in advance!

    Read the article

  • Space-efficient data structures for broad-phase collision detection

    - by Marian Ivanov
    As far as I know, these are three types of data structures that can be used for collision detection broadphase: Unsorted arrays: Check every object againist every object - O(n^2) time; O(log n) space. It's so slow, it's useless if n isn't really small. for (i=1;i<objects;i++){ for(j=0;j<i;j++) narrowPhase(i,j); }; Sorted arrays: Sort the objects, so that you get O(n^(2-1/k)) for k dimensions O(n^1.5) for 2d and O(n^1.67) for 3d and O(n) space. Assuming the space is 2D and sortedArray is sorted so that if the object begins in sortedArray[i] and another object ends at sortedArray[i-1]; they don't collide Heaps of stacks: Divide the objects between a heap of stacks, so that you only have to check the bucket, its children and its parents - O(n log n) time, but O(n^2) space. This is probably the most frequently used approach. Is there a way of having O(n log n) time with less space? When is it more efficient to use sorted arrays over heaps and vice versa?

    Read the article

  • Collision detection, stop gravity

    - by Scott Beeson
    I just started using Gamemaker Studio and so far it seems fairly intuitive. However, I set a room to "Room is Physics World" and set gravity to 10. I then enabled physics on my player object and created a block object to match a platform on my background sprite. I set up a Collision Detection event for the player and the block objects that sets the gravity to 0 (and even sets the vspeed to 0). I also put a notification in the collision event and I don't get that either. I have my key down and key up events working well, moving the player left and right and changing the sprites appropriately, so I think I understand the event system. I must just be missing something simple with the physics. I've tried making both and neither of the objects "solid". Pretty frustrating since it looks so easy. The player starting point is directly above the block object in the grid and the player does fall through the block. I even made the block sprite solid red so I could see it (initially it was invisible, obviously).

    Read the article

  • Circle collision detection and Vector math: HELP?

    - by Griffin
    Hey so i'm currently going through the wildbunny blog to learn about collision detection, but i'm a bit confused on how the vectors he's talking about come into play QUOTED BLOG: p = ||A-B|| – (r1+r2) The two spheres are penetrating by distance p. We would also like the penetration vector so that we can correct the penetration once we discover it. This is the vector that moves both circles to the point where they just touch, correcting the penetration. Importantly it is not only just a vector that does this, it is the only vector which corrects the penetration by moving the minimum amount. This is important because we only want to correct the error, not introduce more by moving too much when we correct, or too little. N = (A-B) / ||A-B|| P = N*p Here we have calculated the normalised vector N between the two centres and the penetration vector P by multiplying our unit direction by the penetration distance. Ok so i understand that p is the distance each circle is penetrating each other, but i don't get what exactly N and P is. it seems to me N is just the coordinates of the 3rd point of the right trianlge formed by point A and B (A-B) then being divided by the hypotenuse of that triangle or distance between A and B (||A-B||) Whats the significance of this? Also, what is the penetration vector used for? It seems to me like a movement that one of the circles would perform to get un-penetrated.

    Read the article

  • 2D Side scroller collision detection

    - by Shanon Simmonds
    I am trying to do some collision detection between objects and tiles, but the tiles do not have there own x and y position, they are just rendered to the x and y position given, there is an array of integers which has the ids of the tiles to use(which are given from an image and all the different colors are assigned different tiles) int x0 = camera.x / 16; int y0 = camera.y / 16; int x1 = (camera.x + screen.width) / 16; int y1 = (camera.y + screen.height) / 16; for(int y = y0; y < y1; y++) { if(y < 0 || y >= height) continue; // height is the height of the level for(int x = x0; x < x1; x++) { if(x < 0 || x >= width) continue; // width is the width of the level getTile(x, y).render(screen, x * 16, y * 16); } } I tried using the levels getTile method to see if the tile that the object was going to advance to, to see if it was a certain tile, but, it seems to only work in some directions. Any ideas on what I'm doing wrong and fixes would be greatly appreciated. What's wrong is that it doesn't collide properly in every direction and also this is how I tested for a collision in the objects class if(!level.getTile((x + xa) / 16, (y + ya) / 16).isSolid()) { x += xa; y += ya; } EDIT: xa and ya represent the direction as well as the movement, if xa is negative it means the object is moving left, if its positive it is moving right, and same with ya except negative for up, positive for down.

    Read the article

  • libgdx collision detection / bounding the object

    - by johnny-b
    i am trying to get collision detection so i am drawing a red rectangle to see if it is working, and when i do the code below in the update method. to check if it is going to work. the position is not in the right place. the red rectangle starts from the middle and not at the x and y point?Huh so it draws it wrong. i also have a getter method so nothing wrong there. bullet.set(getX(), getY(), getOriginX(), getOriginY()); this is for the render shapeRenderer.begin(ShapeType.Filled); shapeRenderer.setColor(Color.RED); shapeRenderer.rect(bullet.getX(), bullet.getY(), bullet.getOriginX(), bullet.getOriginY(), 15, 5, bullet.getRotation()); shapeRenderer.end(); i have tried to do it with a circle but the circle draws in the middle and i want it to be at the tip of the bullet. at the front of the bullet. x, y point. boundingCircle.set(getX() + getOriginX(), getY() + getOriginY(), 4.0f); shapeRenderer.begin(ShapeType.Filled); shapeRenderer.setColor(Color.RED); shapeRenderer.circle(bullet.getBoundingCircle().x, bullet.getBoundingCircle().y, bullet.getBoundingCircle().radius); shapeRenderer.end(); thank you need it to be of the x and y as the bullet is in the middle of the sprite when drawn originally via paint.

    Read the article

  • Collision detection - player gets stuck in platform when jumping

    - by Sun
    So I'm having some problems with my collision detection with my platformer. Take the image below as an example. When I'm running right I am unable to go through the platform, but when I hold my right key and jump, I end up going through the object as shown in the image, below is the code im using: if(shapePlatform.intersects(player.getCollisionShape())){ Vector2f vectorSide = new Vector2f(shapePlatform.getCenter()[0] - player.getCollisionShape().getCenter()[0], shapePlatform.getCenter()[1] - player.getCollisionShape().getCenter()[1]); player.setVerticleSpeed(0f); player.setJumping(false); if(vectorSide.x > 0 && !(vectorSide.y > 0)){ player.getPosition().set(player.getPosition().x-3, player.getPosition().y); }else if(vectorSide.y > 0){ player.getPosition().set(player.getPosition().x, player.getPosition().y); }else if(vectorSide.x < 0 && !(vectorSide.y > 0)){ player.getPosition().set(player.getPosition().x+3, player.getPosition().y); } } I'm basically getting the difference between the centre of the player and the centre of the colliding platform to determine which side the player is colliding with. When my player jumps and walks right on the platform he goes right through. The same can also be observed when I jump on the actual platform, should I be resetting the players y in this situation?

    Read the article

  • Collision detection between a sprite and rectangle in canvas

    - by Andy
    I'm building a Javascript + canvas game which is essentially a platformer. I have the player all set up and he's running, jumping and falling, but I'm having trouble with the collision detection between the player and blocks (the blocks will essentially be the platforms that the player moves on). The blocks are stored in an array like this: var blockList = [[50, 400, 100, 100]]; And drawn to the canvas using this: this.draw = function() { c.fillRect(blockList[0][0], blockList[0][1], 100, 100); } I'm checking for collisions using something along these lines in the player object: this.update = function() { // Check for collitions with blocks for(var i = 0; i < blockList.length; i++) { if((player.xpos + 34) > blockList[i][0] && player.ypos > blockList[i][1]) { player.xpos = blockList[i][0] - 28; return false; } } // Other code to move the player based on keyboard input etc } The idea is if the player will collide with a block in the next game update (the game uses a main loop running at 60Htz), the function will return false and exit, thus meaning the player won't move. Unfortunately, that only works when the player hits the left side of the block, and I can't work out how to make it so the player stops if it hits any side of the block. I have the properties player.xpos and player.ypos to help here.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >