| 01-19-2007, 08:35 PM | #1 |
i searched and i found vector system, rolling boulder ect.. i dont understand jass. when my ball unit hits a wall i want him to bounce. i have a slide affect for my ball unit. my ball unit slides towards the facing of ball unit. so basicly when he hits wall i want his direction to flip (bounce). any way of doing this with out jass? or giving me a jass peace that a dummie can under stand? |
| 01-19-2007, 08:47 PM | #2 |
The easiest way I found is to have a constant value for how much the unit will be moved by X/Y. When a unit hits a wall, let's say that's above it, you then set the Y value to -1 * Y. When it would hit a wall to either side (left/right) you'd set the X movement to -1 * X. This is the only way I know of doing it, though I'm sure there's some formula for getting the opposite angle. |
| 01-19-2007, 09:09 PM | #3 |
how would i detect it hitting the wall? |
| 01-19-2007, 09:13 PM | #4 |
It's pretty simple. By a wall, I'm sure you're referring to a cliff. You just check the cliff level of the X/Y position before moving the unit, if it's higher than the cliff level the unit is currently on, it's a wall. |
| 01-19-2007, 09:19 PM | #5 |
xy as in position? what triggers would i set up to do that? checking it and all that.... |
| 01-19-2007, 09:32 PM | #6 |
Unfortunately it's not that simple. You also have to know the orientation of the cliff and the direction of the ball in order to determin the reflected angle. |
| 01-19-2007, 09:48 PM | #7 |
can you give me an example? what he event condition and actions would look like... im sure i could figure it out if i have something to work with ![]() |
| 01-19-2007, 10:13 PM | #8 |
There really isn't an event you can use. There should be a condition that is checked when the ball is sliding into a wall like the one wyrmlord mentioned. After that you have to determine the orientation of the wall. There have been a few different methods of doing this and usually they include placing a set of dummy units and performing some observations about their location. After that it's simply a matter of changing the velocity of the ball according to the Law of Reflection. |
| 01-19-2007, 11:29 PM | #9 |
Yeah, you need a big nest of regions and a tolerance for high lag if you go that stuff in GUI. |
| 01-19-2007, 11:39 PM | #10 |
If you're just using cliffs, you shouldn't need to. You just check for cliff level/pathing for the X and then Y coordinates, if either of them are on unpathable terrain, you simply multiply the change in X/Y by -1. |
| 01-19-2007, 11:44 PM | #11 |
Cliffs can appear with lengths on more than one axis. |
| 01-20-2007, 03:22 PM | #12 |
can some one tell me what triggers i would use? i assumed that but that dosent work. ang is the angle of unit, point on is the position its duna move very 20 secs and ball is the ball... |
| 01-20-2007, 03:37 PM | #13 |
You have a common mistake. You need some way of changing the facing angle of the unit when it hits the cliff, or it will just slide along it for eternity. |
| 01-20-2007, 04:15 PM | #14 |
doing it some how like in this jesp? http://www.wc3campaigns.net/showthre...ht=rubber+ball there must be some where! ![]() |
| 01-20-2007, 05:53 PM | #15 |
Also, why are you using "Ball[(Integer A)]". Where's that (Integer A) coming from? Additionally, you may want to change that "x -1.00) degrees" to "- 180.00) degrees". If I remember correctly, 10? x -1 = -10?, which is actually 350?... |
