All I need is how to resolve collision when the moving object is moving diagonally.
I have already implemented one-directional resolution but whenever the object moves diagonally the object jumps like he collided on the x axis ( because this is checked before y ).
Example code or article links are greatly appreciated.
Edit: Edited the subject because I am an idiot. SHOCKER!
[Solved]Simple Axis-aligned rectangular collision resolution
Moderator: PC Supremacists
-
- Chaos Rift Regular
- Posts: 198
- Joined: Thu Mar 26, 2009 8:42 pm
- Current Project: My Engine
- Programming Language of Choice: C++
[Solved]Simple Axis-aligned rectangular collision resolution
Last edited by RandomDever on Thu Aug 09, 2012 6:11 pm, edited 3 times in total.
My first game: http://donsvoice.com/randomdever/Duck%2 ... 01.0.0.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Simple Non-axis-aligned box collision resolution
Umm.. AABBs can move diagonally, so I'm assuming you mean detecting collision between objects which are not axis-aligned?RandomDever wrote:All I need is how to resolve collision when the moving object is moving diagonally.
If so, search the forums for one of the many Separating Axis Theorem posts.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
-
- Chaos Rift Regular
- Posts: 198
- Joined: Thu Mar 26, 2009 8:42 pm
- Current Project: My Engine
- Programming Language of Choice: C++
Re: Simple Axis-aligned rectangular collision resolution
Yep I said that but that's not what I mean't.
Just simple rectangular collision which is Axis-aligned I guess.
Just so I don't have to edit the entire post again axis-aligned means no rotation right?
Just simple rectangular collision which is Axis-aligned I guess.
Just so I don't have to edit the entire post again axis-aligned means no rotation right?
My first game: http://donsvoice.com/randomdever/Duck%2 ... 01.0.0.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Simple Axis-aligned rectangular collision resolution
You could try:
viewtopic.php?f=13&t=5767
or
viewtopic.php?f=13&t=5635
or
viewtopic.php?f=6&t=5416
or
viewtopic.php?f=6&t=5074
or
viewtopic.php?f=6&t=4293
or
viewtopic.php?f=6&t=4130
More:
search.php?keywords=collision
viewtopic.php?f=13&t=5767
or
viewtopic.php?f=13&t=5635
or
viewtopic.php?f=6&t=5416
or
viewtopic.php?f=6&t=5074
or
viewtopic.php?f=6&t=4293
or
viewtopic.php?f=6&t=4130
More:
search.php?keywords=collision
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
-
- Chaos Rift Regular
- Posts: 198
- Joined: Thu Mar 26, 2009 8:42 pm
- Current Project: My Engine
- Programming Language of Choice: C++
Re: Simple Axis-aligned rectangular collision resolution
Thanks dandymcgee that first article worked like a charm.
I now have a basic physics engine.
BTW does anyone know why my rendering is jumpy?
It seems to jump consistently every second. So I render a square moving 60 pixels per second and every second it jumps ahead a few pixels. It's not super noticeable but it is noticeable.
I now have a basic physics engine.
BTW does anyone know why my rendering is jumpy?
It seems to jump consistently every second. So I render a square moving 60 pixels per second and every second it jumps ahead a few pixels. It's not super noticeable but it is noticeable.
My first game: http://donsvoice.com/randomdever/Duck%2 ... 01.0.0.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
- superLED
- Chaos Rift Junior
- Posts: 303
- Joined: Sun Nov 21, 2010 10:56 am
- Current Project: Engine
- Favorite Gaming Platforms: N64
- Programming Language of Choice: C++, PHP
- Location: Norway
Re: Simple Axis-aligned rectangular collision resolution
I had that shit in my programs as well. I think it was something to do with the 60 FPS-limitation. After a second, it noticed that the program was running too fast, and then slowed down a bit. Or hurried up, depending on the CPU-speed.RandomDever wrote:Thanks dandymcgee that first article worked like a charm.
I now have a basic physics engine.
BTW does anyone know why my rendering is jumpy?
It seems to jump consistently every second. So I render a square moving 60 pixels per second and every second it jumps ahead a few pixels. It's not super noticeable but it is noticeable.
-
- Chaos Rift Regular
- Posts: 198
- Joined: Thu Mar 26, 2009 8:42 pm
- Current Project: My Engine
- Programming Language of Choice: C++
Re: Simple Axis-aligned rectangular collision resolution
I reduced the frame rate to 50 and seems to be better.
But running at such a low frame rate makes getting a fast velocity to look good difficult.
But I'll see how it looks when I test animation and I'll return here if I have any questions.
Marking as solved.
But running at such a low frame rate makes getting a fast velocity to look good difficult.
But I'll see how it looks when I test animation and I'll return here if I have any questions.
Marking as solved.
My first game: http://donsvoice.com/randomdever/Duck%2 ... 01.0.0.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip
My second game: http://donsvoice.com/randomdever/Space%20Invaders.zip
My third game: http://donsvoice.com/randomdever/BreakOut!.zip