Search Results

Search found 3988 results on 160 pages for 'collision resolution'.

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

  • How can I resolve collisions at different speeds, depending on the direction?

    - by Raven Dreamer
    I have, for all intents and purposes, a Triangle class that objects in my scene can collide with (In actuality, the right side of a parallelogram). My collision detection and resolution code works fine for the purposes of preventing a gameobject from entering into the space of the Triangle, instead directing the movement along the edge. The trouble is, the maximum speed along the x and y axis is not equivalent in my game, and moving along the Y axis (up or down) should take twice as long as an equivalent distance along the X axis (left or right). Unfortunately, these speeds apply to the collision resolution too, and movement along the blue path above progresses twice as fast. What can I do in my collision resolution to make sure that the speedlimit for Y axis movement is obeyed in the latter case? Collision Resolution for this case below (vecInput and velocity are the position and velocity vectors of the game object): // y = mx+c // solve for y. M = 2, x = input's x coord, c = rightYIntercept lowY = 2*vecInput.x + parag.rightYIntercept ; ... else { // y = mx+c // vecInput.y = 2(x) + RightYIntercept // (vecInput.y - RightYIntercept) / 2 = x; //if velocity.Y (positive) greater than velocity.X (negative) //pushing from bottom, so push right. if(velocity.y > -1*velocity.x) { //change the input vector's x position to match the //y position on the shape's edge. Formula for line: Y = MX+C // M is 2, C is rightYIntercept, y is the input y, solve for X. vecInput = new Vector2((vecInput.y - parag.rightYIntercept)/2, vecInput.y); Debug.Log("adjusted rightwards"); } else { vecInput = new Vector2( vecInput.x, lowY); Debug.Log("adjusted downwards"); } }

    Read the article

  • Collision filtering by object, team

    - by Bill Zimmerman
    Hi, I am looking for a good method to determine which objects will be considered for collision with other objects. My current idea is that each object has the following properties: alwaysCollidesWith = [list of objects that will always trigger a collision check] neverCollidesWith = [lost of objects that will never be considered] teamCollidesWith = [list of objects that will be checked, provided they belong to a different team] For example: -projectiles never have to be checked for collisions with other projectiles -players are always checked for collisions with players, regardless of team -projectiles are only considered for collisions if they collide with another teams players Does anyone see any weaknesses with this approach? Can anyone recommend a better approach?

    Read the article

  • how to create 2D collision detection

    - by Aidan Mueller
    I would like to know the best or most effective way to test for 2D collision. I also can do AABBs but when you have a line, for example, that is rotated 45º, and it is really long. it will be hitting things when it shouldn't. I might be able to go through the pixels to see if they are touching others, but that might be slow if I had a big picture. and it might add some complications if I had a movie clip made of several images. How do I check collision between two Images? How would I do circle to box? Please help : ) PS: I do know java so you can write with java syntax and then use a made up GL

    Read the article

  • Xubuntu 14.04 resolution low

    - by user3203576
    I installed Xubuntu 14.04 amd64 on the computer at the computer repair shop where I work, but the screen resolution is way low, like 1024 x 768 (that wouldn't be low for a laptop or anything, but for a large desktop screen it is) I went to the display settings, but the resolution wouldn't go higher than that. When I installed Xubuntu 14.04 i386 at my computer at home, I didn't have any problems with the resolution. Any help? update: I ran lspci | grep VGA and got: 00:0d.0 VGA compatible controller: NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2)

    Read the article

  • How to change resolution to 1920 x 1080?

    - by jacknad
    The display looks a bit stretched and there is a system pop-up that says something like "Resolution Notice: for best quality change resolution to 1920 x 1080" but in Monitor Preferences the only choices in the Resolution drop-down are 1600 x 1200 (the current setting), 1280 x 1024, and less (which all look worse). The monitor preferences calls the Monitor "unknown," the monitor is a ViewSonic VX2450WM, and the PC is an HP p7-1120.

    Read the article

  • Loads wrong resolution when installing

    - by Kevin DB
    I'm trying to install Ubuntu 11.04 from a USB. My computer does load the USB file and I get some sort of BIOS-like screen where I can choose between 'Install from USB' and 'Boot-up from USB'. When I entered the corresponding number my screen resolution is totally messed up. I see that Ubuntu is starting up when I used Boot from USB, but the screen looks the same as you'd have a too high screen resolution. Same story with Install from USB. I can see the screens loading and the menu's and stuff, but not clearly because it load in a too high screen resolution. I'm trying to dual-boot is with Windows XP and max. screen resolution is 800x600.

    Read the article

  • Setting up collision using a tilemap and cocos2d

    - by James
    I'm building my first platformer using cocos2d and a tilemap. I'm having trouble coming up with a decent way of determining if the character is colliding with an object. More specifically, in which direction is the character colliding with an object. Following the tutorial here, I have made a separate "meta" layer of collidable tiles. The problem is that unless the character is in the tile, you can't detect the collision. Also, there's no way of telling WHERE the collision is occurring. The best solution would be one that could tell me if a character is up against a wall, or walking on top of a platform. However, I can't seem to figure out a good technique for this.

    Read the article

  • Pong Collision Help in C# w/ XNA

    - by Ramses Brown
    Edit: My goal is to have it function like this: Ball hits 1st Quarter = rebounds higher (aka Y++) Ball hits 2nd Quarter = rebounds higher (using random value) Ball hits 3rd Quarter = rebounds lower (using random value) Ball hits 4th Quarter = rebounds lower (aka Y--) I'm currently using Rectangle Collision for my collision detection, and it's worked. Now I wish to expand it. Instead of it simply detecting whether or not the paddle/ball intersect, I want to make it so that it can determine what section of the paddle gets hit. I wanted it in 4 parts, with each having a different reaction to impact. My first thought is to base it on the Ball's Y position compared to the Paddle's Y position. But since I want it in 4 parts, I don't know how to do that. So it's essentially be if (ball.Y > Paddle.Y) { PaddleSection1 == true; } Except modified so that instead of being top half/bottom half, it's 1st Quarter, etc.

    Read the article

  • Android Touch Event Collision Detection

    - by chrissb
    I'm relatively new to both Java and Android, so hopefully the problem I'm having is stemming from something pretty minor that I've overlooked. I've got a (very early stage) game that I've started working on, for Android using Java. At this stage, when the user touches the screen, if they touched a point at which there is an enemy, the enemies health is decreased and they become immobile (for the current implementation at least). The issue that I'm having is that the touch detection doesn't always seem to work. I've got a testing sprite set up that goes to the eventX and eventY coordinates of the touch down event, and it always seems to collide with the enemy object. Yet, the enemy doesn't always register as being hit, and sometimes a hit is registered when the sprite indicates the touch coordinates were outside of the enemies bounding box. I realise that this probably doesn't mean much without any code, so here's what I've got so far. Be gentle, as this is literally my first attempt at something more than basic movement etc. First off, the MainGamePanel class registers the touch event, and informs the levelmanager class (which is what I set up to monitor/handle enemies) public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN){ levelManager.handleActionDown((int)event.getX(), (int)event.getY()); targetX=event.getX(); targetY=event.getY(); } if (event.getAction() == MotionEvent.ACTION_MOVE) { //the gestures } if (event.getAction() == MotionEvent.ACTION_UP) { //touch was released } return true; } From there, in the levelmanager class the touch event is passed on to all of the enemies within a list array: public static void handleActionDown(int eventX,int eventY){ hit=false; for (enemy1 en : enemy1array){ en.handleActionDown(eventX, eventY); } } The rest of the collision code is handled within the enemies handleActionDown function: public void handleActionDown(int eventX, int eventY) { if(eventX>this.x-enemy1bitmap.getWidth() && eventX<this.x+enemy1bitmap.getWidth() && eventY>this.y-enemy1bitmap.getHeight() && eventY<this.x+enemy1bitmap.getHeight()){ takeDamage(1); levelmanager.setHit(); } } I should probably be using getWidth()/2 and getHeight()/2 for it to be more accurate, but I expanded the area to test this - although I've noticed no improvement. At this stage, the games detection over whether or not the enemy is hit is spotty at best. Generally it takes two or three attempts before a collision is successfully registered, even though the sprite that is being used for testing and set to the eventX and eventY coordinates always indicates that the collision should have worked. Hopefully someone can steer me in the right direction here, and if more information is needed, ask away! Cheers, -Chris

    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

  • SFX Played Once per Collision or Hit

    - by David Dimalanta
    I have a question about using Box2D (engine for LibGDX used to make realistic physics). I observed on the code that I've made for the physics here below: @Override public boolean touchUp(int screenX, int screenY, int pointer, int button) { // TODO Touch Up Event if(is_Next_Fruit_Touched) { BodyEditorLoader Fruit_Loader = new BodyEditorLoader(Gdx.files.internal("Shape_Physics/Fruity Physics.json")); Fruit_BD.type = BodyType.DynamicBody; Fruit_BD.position.set(x, y); FixtureDef Fruit_FD = new FixtureDef(); // --> Allows you to make the object's physics. Fruit_FD.density = 1.0f; Fruit_FD.friction = 0.7f; Fruit_FD.restitution = 0.2f; MassData mass = new MassData(); mass.mass = 5f; Fruit_Body[n] = world.createBody(Fruit_BD); Fruit_Body[n].setActive(true); // --> Let your dragon fall. Fruit_Body[n].setMassData(mass); Fruit_Body[n].setGravityScale(1.0f); System.out.println("Eggs... " + n); Fruit_Loader.attachFixture(Fruit_Body[n], Body, Fruit_FD, Fruit_IMG.getWidth()); Fruit_Origin = Fruit_Loader.getOrigin(Body, Fruit_IMG.getWidth()).cpy(); is_Next_Fruit_Touched = false; up = y; Gdx.app.log("Initial Y-coordinate", "Y at " + up); //Once it's touched, the next fruit will set to drag. if(n < 50) { n++; }else{ System.exit(0); } } return true; } Now, I'm thinking which part o line should I implement for the sound effects. My objectives to make SFX played once for every collision (Or should I say "SFX played once per collision"?) on the following: SFX played once if they hit on the objects of its kind. (e.g. apple vs. apple) SFX played once on a different sound when it hit on the ground. (e.g. apple land on the mud) Take note that I'm using Box2D for the Java programming version thanks to LibGDX via Box2D engine and I edited the physics body using Physics Body Editor before I implement it to code. I tried to check every available methods for body, fixture definition, or body definition to code for the SFX when hit but it seems only for the gravity and weight. Is there possibly available on the document for SFX played when collision happens if possible?

    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

  • Ubuntu 10.10 netbook Screen Resolution Sony Vaio FS315

    - by Fatos
    Hello, I've just installed ubuntu 10.10 on my laptop its all great but the screen resolution is a bit crap i have it set 1200:800 and when i do xrandr it indicates that the i can have a bigger screen resolution but i dont seem to to be able to increase it more 1200:800 through monitor tool. another interesting thing is that xorg.conf does not exist on the /etc/X11/ is there a way to increase the screen resolution for Sony laptops? The graphics card is Intel Graphics Please help! I didnt think it would be so hard to change the screen resolution

    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

  • Resolution stuck in 640x480 in grub, 11.04 and 12.04

    - by user89797
    I have three operating systems on my machine, Windows 7x64, Ubuntu 11.10 and 12.04 both x64 as well. All three were running at full resolution for my monitor, as well as in the Grub 1.99 boot screen. After booting into Windows, I rebooted my machine and found my Grub resolution was suddenly 640x480. Booting into both versions of Ubuntu, I find myself stuck at that resolution as well. I made no driver changes recently, and hadn't even booted into the 11.10 build in a month or more. I've gone through both proprietary Nvidia driver options for my card (GeForce 9800GT) as well as the open source drivers in 12.04 to no avail. I can't figure out what could have caused this change in both versions of Ubuntu and Grub simultaneously. Windows 7 is unaffected so I think that safely rules out hardware failure. EDIT Ok, so I couldn't boot an graphical live disks, I tried ubuntu 12.04 i386 and x64 as well as 12.10 beta x64 and all of them would flash the initial logo, go to a blank screen with a flashing cursor in the upper left and then my display would die. I managed to boot 12.04 server and get into recovery. I reinstalled grub and went into recovery mode for my 12.04 build. If I boot in safe graphics mode I can get 1280x768, but as soon as I reboot it's broken again. I've tried reinstalling the nvidia drivers and that leaves me with a system stuck at max 640x480. None of these changes have had any impact on the 11.10 build, which is still stuck at 640x480 Given that I can push a somewhat higher resolution in 12.04, and full resolution in windows 7 I'm pretty convinced it's not an issue of my monitor failing. It must be something to do with the graphics drivers. I can't figure out what could be the issue though. I'm especially perplexed that I can't boot any live images

    Read the article

  • Resolution Independent 2D Rendering in XNA

    - by AttackingHobo
    I am trying to figure out the best way to render a 2d game at any resolution. I am currently rendering the game at 1920x1200. I am trying scale the game to any user selected resolution without changing the way I am rendering, or game logic. What is the best way to scale a game to any arbitrary resolution? Edit: I am trying to achieve this: http://www.david-amador.com/2010/03/xna-2d-independent-resolution-rendering/ but I think the code he has is for a different version of XNA because I cannot find that method overload he uses.

    Read the article

  • Ubuntu 12.10 - Resolution stuck at 1024x768 using Open Source Radeon Driver

    - by mumble
    I'm using Ubuntu 12.10 with an ATI Radeon HD5670 card. I currently have the open source xorg-edgers driver. I've been using this driver interchangeably with the Radeon open source driver since fglrx seems to give me a lot of freezes. So I can't really use proprietary drivers, the Radeon driver seems to be stable for me, the resolution is the only problem. The resolution is stuck at 1024x768, where my monitor's native resolution is 1366x768. How do I enable that resolution? Going to System Settings Display only gives me 800x600 and 1024x768 by the way. And just another question, how do I know if xorg-edgers driver is enabled? When I run sudo lshw -c video, I still see the radeon driver. configuration: driver=radeon latency=0 Thanks a lot in advance!

    Read the article

  • Higher screen resolution in VirtualBox?

    - by pelms
    I've just installed Ubuntu 10.04 into VirtualBox on Windows 7. Unfortunately the only options showing for screen resolution are 640x480 and 800x600 and the monitor is showing as 'Unknown'. How would I go about upping the resolution to 1280x1024 (I'm on a 1600x1200 monitor)? Update I tried mounting the VirtualBox 'Guest Additions' ISO (from the VBox 'Devices' menu) and doing sudo sh ./VBoxLinuxAdditions-x86.run from the mounted drive, which gave 2 new listed resolutions after a reboot (1024x768 and the 16:9 version of that resolution). These worked when I selected them but disappeared when I switched back to another resolution. I tried rebooting and running VBoxLinuxAdditions-x86.run again but onlu the 2 low res options listed this time. I think I'm going to reinstall... Seems to be a VBox problem rather than an Ubuntu problem as after reinstalling 10.4 overwriting the original virtual partition, sudo sh ./VBoxLinuxAdditions-x86.run now has no affect at all.

    Read the article

  • HTML5 platformer collision detection problem

    - by fnx
    I'm working on a 2D platformer game, and I'm having a lot of trouble with collision detection. I've looked trough some tutorials, questions asked here and Stackoverflow, but I guess I'm just too dumb to understand what's wrong with my code. I've wanted to make simple bounding box style collisions and ability to determine on which side of the box the collision happens, but no matter what I do, I always get some weird glitches, like the player gets stuck on the wall or the jumping is jittery. You can test the game here: Platform engine test. Arrow keys move and z = run, x = jump, c = shoot. Try to jump into the first pit and slide on the wall. Here's the collision detection code: function checkCollisions(a, b) { if ((a.x > b.x + b.width) || (a.x + a.width < b.x) || (a.y > b.y + b.height) || (a.y + a.height < b.y)) { return false; } else { handleCollisions(a, b); return true; } } function handleCollisions(a, b) { var a_top = a.y, a_bottom = a.y + a.height, a_left = a.x, a_right = a.x + a.width, b_top = b.y, b_bottom = b.y + b.height, b_left = b.x, b_right = b.x + b.width; if (a_bottom + a.vy > b_top && distanceBetween(a_bottom, b_top) + a.vy < distanceBetween(a_bottom, b_bottom)) { a.topCollision = true; a.y = b.y - a.height + 2; a.vy = 0; a.canJump = true; } else if (a_top + a.vy < b_bottom && distanceBetween(a_top, b_bottom) + a.vy < distanceBetween(a_top, b_top)) { a.bottomCollision = true; a.y = b.y + b.height; a.vy = 0; } else if (a_right + a.vx > b_left && distanceBetween(a_right, b_left) < distanceBetween(a_right, b_right)) { a.rightCollision = true; a.x = b.x - a.width - 3; //a.vx = 0; } else if (a_left + a.vx < b_right && distanceBetween(a_left, b_right) < distanceBetween(a_left, b_left)) { a.leftCollision = true; a.x = b.x + b.width + 3; //a.vx = 0; } } function distanceBetween(a, b) { return Math.abs(b-a); }

    Read the article

  • 2D collision resolving

    - by Philippe Paré
    I've just worked out an AABB collision algorithm for my 2D game and I was very satisfied until I found out it only works properly with movements of 1 in X and 1 in Y... here it is: public bool Intersects(Rectanglef rectangle) { return this.Left < rectangle.Right && this.Right > rectangle.Left && this.Top < rectangle.Bottom && this.Bottom > rectangle.Top; } public bool IntersectsAny(params Rectanglef[] rectangles) { for (int i = 0; i < rectangles.Length; i++) { if (this.Left < rectangles[i].Right && this.Right > rectangles[i].Left && this.Top < rectangles[i].Bottom && this.Bottom > rectangles[i].Top) return true; } return false; } and here is how I use it in the update function of my player : public void Update(GameTime gameTime) { Rectanglef nextPosX = new Rectanglef(AABB.X, AABB.Y, AABB.Width, AABB.Height); Rectanglef nextPosY; if (Input.Key(Key.Left)) nextPosX.X--; if (Input.Key(Key.Right)) nextPosX.X++; bool xFree = !nextPosX.IntersectsAny(Boxes.ToArray()); if (xFree) nextPosY = new Rectanglef(nextPosX.X, nextPosX.Y, nextPosX.Width, nextPosX.Height); else nextPosY = new Rectanglef(AABB.X, AABB.Y, AABB.Width, AABB.Height); if (Input.Key(Key.Up)) nextPosY.Y--; if (Input.Key(Key.Down)) nextPosY.Y++; bool yFree = !nextPosY.IntersectsAny(Boxes.ToArray()); if (yFree) AABB = nextPosY; else if (xFree) AABB = nextPosX; } What I'm having trouble with, is a system where I can give float values to my movement and make it so there's a smooth acceleration. Do I have to retrieve the collision rectangle (the rectangle created by the other two colliding)? or should I do some sort of vector and go along this axis until I reach the collision? Thanks a lot!

    Read the article

  • libgdx - collision detection with tiled map java

    - by user2875021
    currently, I am working on a 2d rpg game which is similar to final fantasy 1-4. I can load up a tiled map and the sprite can walk freely on the map. However, I will like to create a wall for it to stop walking through it. I created three tiled layer Background, Collision, Overhead and one Collision object layer with rectangles only. "How do I handle collisions with the object layer in the tiled map?" "Do I have to create every single rectangle that is in the object layer with Rectangle rectangle = new Rectangle() and rectangle.set(x, y, width, height)in the code?" Thank you very much in advance. Any help is greatly appreciated!

    Read the article

  • How to design 2D collision callback methods?

    - by Ahmed Fakhry
    In a 2D game where you have a lot of possible combination of collision between objects, such as: object A vs object B = object B vs A; object A vs object C = object C vs A; object A vs object D = object D vs A; and so on ... Do we need to create callback methods for all single type of collision? and do we need to create the same method twice? Like, say a bullet hits a wall, now I need a method to penetrate the wall for the wall, and a method to destroy the bullet for the bullet!! At the same time, a bullet can hit many objects in the game, and hence, more different callback methods!!! Is there a design pattern for that?

    Read the article

  • 3D Mesh Collision Help

    - by BlackAfricano
    I am new to XNA (I have only been working in it for a countable number of weeks) as well as to these forums (I have only made 1-2 other posts), so this may seem like a strange request, but I am wondering if anybody knows about more advanced collision in XNA. So far I have only been able to figure out BoundingSphere's which seem to be the simplest of the methods, and I was thinking of looking more into BoundingBoxes because the game I have is a 2-3D platformer. The problem I realized was that if I wanted to get any more advanced than stages in the shape of a box, I would face some immediate dilemmas. I was hoping somebody here was knowledgeable on the subject and could inform me where I could get started learning how to do something like this: https://www.youtube.com/watch?v=ekMD_Gtt8d4 Although the game in this video isn't very pretty, the mesh collision looks like what I'm looking for. I am hoping for the most complete solution, if possible.

    Read the article

  • external monitor can't display max resolution

    - by mp94
    I had been using an external monitor, an old Dell Inc. 19" with Ubuntu 14.04 for a while now, The resolution it displayed at was something like 1366x768 or 1366x1024, I can't remember exactly which one it was. However, one day when I restarted my computer, I can no longer get that resolution on the external display, and can now display a max resolution of 1024x768. Does anyone know why this might happen all of a sudden? I think it was after running a system update.

    Read the article

  • using per pixel collision for an elastic response

    - by Codejoy
    I realize this might be open ended ended but curious if I just did some over kill... I had this http://create.msdn.com/en-US/education/catalog/tutorial/collision_2d_perpixel and i reworked it to work with my animation code in XNA and what not. It works well, but now I want to use this to decide if there was a collision and to have the items (characters) bounce off eachother elastically. Was the per pixel too much and I could of just used a bounding box ? (in fact would that of been preferred for what needs to be calculated in the response for an elastic collision?) Looking for guidance really.

    Read the article

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