| 07-25-2006, 11:51 PM | #1 |
this is directed towards Vex more than anything, though anyone who knows could help me out I was wondering how, like in your rolling boulder spell, you make things realistically bounce off things I am not interested, nor need help with, the coding to move things, check cliff heights, etc., I just need and am not quite sure about the actual functions(equations/methods) that take into consideration the angle your going, the angle of the wall, speed, etc. for bouncing off I tried figureing it out from your code, Vex, but I was completely confused soemthing to with with creating items, then checking angles, and that is about as much out of it as I got ty to anyone who can shed light on this for me :) |
| 07-26-2006, 12:15 AM | #2 |
When it hits a wall (they can only be 0, 90 degrees I suppose?) check around in each direction to see on which side of the wall it hit, then hit back according to that. |
| 07-26-2006, 01:31 AM | #3 |
I'm guessing that Vexorian's method was something similar to this: Create some dummies along the edge of the wall your checking and find the angle between them. Use the angle between your bouncing object's direction and the normal to the angle you found with the dummies as the incidence angle. After getting the incidence angle, treat the wall angle as your reference for the amount of rotation and calculate the reflected angle. |
| 07-26-2006, 02:54 AM | #4 |
I just used items. And the bouncing was mostly brute force don't even I know how that works |
| 07-26-2006, 03:33 AM | #5 |
Technically bouncing is done by drawing a line perpendicular to the wall that the bouncing object is hitting and mirror its incomming angle from one side to the other, thereby getting its outgoing angle. The problem here of course is getting the angle of the wall itself, whatever you choose to do that with is up to you, in War3 there's really no perfect solution especially since the problem gets much more difficult the more detailed you want to make it. Once you have the angle of that wall though, everything else is cake. |
| 07-26-2006, 03:34 AM | #6 |
and yes the bruteforcing was related to finding that angle. But well I don't remember how that works |
| 07-26-2006, 03:57 AM | #7 |
Here's what I can suggest on that matter after playing around a bit... In the case of Doodads/Trees, without thinking into it more, I would have to resort to considering them all to be squares. The way that reflects on your calculation is that when the "ball" colides with a tree you compare the X-Distance (distance along the X-Axis) and the Y-Distance between the object and your ball. Then if the X-Distance is smaller it means you've hit the tree/object on the left or right side. If the Y-Distance is smaller, it means that you've hit the tree/object on the top or bottom side. In the case of cliffs though, here's a little trick I would use. First, mentally divide the map into the terrain grid that we're so familiar with. Then in your calculation the first thing you do is determine which grid box your "ball" is in and get the locations of all 4 corners of this grid box: X Location of Left Corners = R2I( x / 128 ) X Location of Right Corners = R2I( x / 128 ) + 128 Y Location of Top Corners = R2I( y / 128 ) Y Location of Bottom Corners = R2I( y / 128 ) + 128 After you have those 4 locations you check GetLocationZ() on all 4 locations and determine which of those locations is higher, then simply assume the following. If two or three locations are higher and they are diagonal or form a triangle. Then you have a 45 degree angle to bounce off of. If two or four locations are higher that means you've got a square flat wall (90 degree) that you're bouncing off of. If one location is higher, then assume a 45 degree angle. It won't be perfect, but it's probably about as accurate as you're going to get without it becoming a nightmare. |
| 07-26-2006, 09:20 AM | #8 |
You're overcomplicating. Just do terrain pathability checks. Just check pathability at small offsets all 4 directions, thus determining in which direction there is a wall - walls can be only horizontal or vertical, so that makes things really easy. Once you establish that there's a wall north of the projectile, and it's y direction speed is positive, flip it's y direction speed. The only thing this doesn't take into account are destructibles, their pathing map doesn't register on the terrain pathability check (doodads, however, do), so you have to loop through them seperately, and do similar checks that you do with units, if you do them. I did them. http://www.wc3campaigns.net/showpost...4&postcount=86 |
| 07-26-2006, 09:31 AM | #9 |
Well, i had build a physik engine too, but it's pretty old. My methode was newb like, but it worked perfectly. I placed 1 rect for every rebounce area and seperated em into 2 kind of rects. North/South and East/West rects. The formula for the angle i used was: North/South: 0 - Angle of incoming Object East/West: 180 - Angle of incoming Object For the movementspeed i picked the unit, moved it instantly to current position offset RealSpeed[Custom-Value of (Picked Unit)] towards RealAngle[C-V of (Picked Unit)] Then i reduced the the value for RealSpeed and so on. BTW: I triggered it in GUI xD |
| 07-26-2006, 12:46 PM | #10 | ||||||
Quote:
Awful Quote:
Quote:
Quote:
Quote:
Quote:
Nah. felt the need to link to : http://www.wc3campaigns.net/showthread.php?t=82894 |
| 07-26-2006, 07:32 PM | #11 | ||
Quote:
Quote:
|
| 07-26-2006, 08:13 PM | #12 |
The path native doesn't work, it does not even consider pathing blockers. |
| 07-26-2006, 08:53 PM | #13 |
Well, walls dont have pathing blockers so thats fine iguess? |
| 07-26-2006, 10:06 PM | #14 |
Antiarf made a wonderful ability, the rolling panda on some spell making session, i think the link he posted refers to that. I think its the best method for creating that effect, he just checked pathing, then angles. |
| 07-26-2006, 11:49 PM | #15 | |
Quote:
|
