flat assembler
Message board for the users of flat assembler.
Index
> Windows > VIDEOGAMES -- To Detect Collision of a Sprite whith Rocks |
Author |
|
oveja 22 Feb 2007, 15:26
To Detect collision whit gravity, is necesary 2 things:
1) Detect collision Sprite whit wall or roof or floor, --> Is Easy, 2) Sprite Reaction, --> Is HardCore. On Step 2, I do not know that to do, somebody help me.
|
|||||||||||
22 Feb 2007, 15:26 |
|
MCD 24 Feb 2007, 04:48
cod3b453 wrote: If the walls, roof and floor are square you can just flip the direction of movements in the x or y direction for a quick and easy reaction. That's the essence and perfectly right. There are just a few thing I wanted to add: The so called collision is (almost) always divided into at least 2 parts in every computer simulation: -collision detection -momentum calculation The latter of the 2 is usually neither trivial, but is manageable with some math/physics experience. The 1st one ("collision detection") seems simpler than the 2nd one when you limit the maximum allowed speed for objects AND the minimum allowed gauge of objects AND the maximum number of objects allowed to collide at each other to 2. If you only have non-rotated rectangular objects and coordinates then it is even more simpler! But in fact collision detection is (probably) the most difficult part in physics-simulations if you don't limit speed (e.g. some objects is allowed to move more in a time step than another object has gauge) and allow objects to collide at any angle/border and you will get a VERY EVIL KIND OF PROBLEM!!! I know what I'm talking about! I tried to solve that problem over and over again in 5 years and did theoretical analysis and different designs and algorithms in different programming languages and NEVER actually managed to get something that worked correct in all cases!!! That's the reason why most professional game studios buy physics engines like the HAVOC engine instead of code one on their own. And even those professional game-physics engines contains bugs because a physics engine with no collision bugs would probably be either way to slow or would need an almost infinite complex distinction of cases! (I'm not talking about little precision bugs, but about bugs where objects that are supposed to collide may cross each other at high speed!) _________________ MCD - the inevitable return of the Mad Computer Doggy -||__/ .|+-~ .|| || |
|||
24 Feb 2007, 04:48 |
|
pabloreda 24 Feb 2007, 13:27
search for the work of Erin Catto,
I see a example with source code, He work with momentum and the result is awesome !! |
|||
24 Feb 2007, 13:27 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.