| 06-26-2004, 04:23 PM | #1 |
This may sound easy but you will understand how complicating it is when you try to get it work. Problem 1: there are two balls, one of them moving and the other static initially. How to simulate their paths after the moving ball collide with the static ball? The important point is the ball is not a straight head on collision but at an angle. (you can imagine using 2 sheep to act as the balls and see if you have any idea how to make this works in War3. And please no need to quote me those physics formula, as I have learnt those in my physics lessons, luckily ;) What I want to ask is how to get it to work in War3 using triggers or even jass.) This one should be easy. Problem 2: now 2 moving balls collide together...... the difficulty is a bit advanced. Problem 3: 3 or more moving balls collide randomly at random time. And this is my main problem. 1 & 2 are ok now, but I still haven't get a perfect solution for 3. [edit]The difficulty of these problems is not the physics formula. It is the "event" that triggers the action causing problem. Problem 1 is easy. "Periodic event + unit within range of another unit" will do the work. I stated it above just to help me to explain 2 and 3. Problem 2: a slightly more advanced. If you use "periodic event + unit within range of another unit" again on ONE of the two ball it would be ok. But if you go to problem 3...... Problem 3: multiple balls are moving, so the "periodic event + unit within range of another unit" won't work if you only assign it to one of the ball. But if you assign it to all the balls, then you will have the problem that the triggers are activated twice for each collision, as each collision involved 2 balls. And this is the main problem of the whole issue. Sorry that I didn't state out this clearly earlier, as I would like to see if there are other solutions go in different direction. Please help me if you have any idea. This is the vital part of a mini game I'm planning, and I'll be most glad if someone can solve the problem! Thanks again! |
| 06-26-2004, 04:47 PM | #2 |
Its all about the cartesian coordianates. Although I dont know much about them, I'll look it up and give you a link. Give me a few seconds here... |
| 06-26-2004, 05:30 PM | #3 |
can you make the value as variables? and make the collision stack? you just update the last action with the latest value. Not to disappoint you, but i think its a great feat that you actually solved the first two problem. :o |
| 06-26-2004, 06:58 PM | #4 | |
Quote:
As I had said in the beginning, this question is not as easy as it seen. Thanks for your "suggestion". Though if you are experience enough with triggers, you will see the difficulties in doing problem 2 and 3. I hope the others can read through my question carefully before giving the answer. If you still not convinced, open the WE and try to write a trigger that will work, as you only so you can understand what I mean. |
| 06-26-2004, 07:15 PM | #5 |
Ok, let me make it a bit more straight forward. The difficulty of these problems is not the physics formula. It is the "event" that triggers the action causing problem. Problem 1 is easy. "Periodic event + unit within range of another unit" will do the work. I stated it above just to help me to explain 2 and 3. Problem 2: a slightly more advanced. If you use "periodic event + unit within range of another unit" again on ONE of the two ball it would be ok. But if you go to problem 3...... Problem 3: multiple balls are moving, so the "periodic event + unit within range of another unit" won't work if you only assign it to one of the ball. But if you assign it to all the balls, then you will have the problem that the triggers are activated twice for each collision, as each collision involved 2 balls. And this is the main problem of the whole issue. Sorry that I didn't state out this clearly earlier, as I would like to see if there are other solutions go in different direction. But if I didn't explain this, there are likely more newbies will try to "help" me out! ;) |
| 06-26-2004, 07:37 PM | #6 | |
Quote:
btw, i don't use 3rd-party w3editor |
| 06-27-2004, 01:30 AM | #7 | |||
Quote:
Well, I think this is trivial. Thanks anyway. Quote:
Sound like it may solve the problem, but WHEN would it check for the final values? Ok, I had considered this solution too. You may make it such that the final value is checked 0.1s after the collision. But as I had mentioned there are now more than 3 balls involved, all the calculation would be messed up if a third ball collide during the 0.1s. Though this is not a bad approach otherwise. Quote:
??? so what? |
| 06-27-2004, 05:33 AM | #8 |
I know this is difficult. I can understand if none of the people here can solve the problem. Though plz post any idea you can think of and it may turn out to be useful finally. And plz no need to reply if you can't even see the tricky point of question 3, as then I won't expect you to be able to solve the problem. |
| 06-27-2004, 03:55 PM | #9 |
Dont underestimate people in the trigger haven. Hehe. If its doable we can probably get it. Turn on a boolean when one ball comes in contact with another. You will need a trigger structured like this: if (collision equal to false) set collision = true do stuff else if collision equal to true set collision = false end if Eh, yes. That should work for a 2 ball collison. It wont work when 3 balls collide at the same exact time. Technically this should not happen. If it does I'm in for some tough triggering. I hope thats what you want. |
| 06-27-2004, 08:23 PM | #10 |
Well, it is possible for three balls to collide simultaneusly. Unlikely, but possible: imagine two balls standing close to one another and the third ball coming in between them. Well, here's my idea: you could detect and document collisions. You have a periodic check, so first you go through all the balls with a loop to detect collision with all the other balls. You store these collisions in variables (firstCollidingUnit(numberOfCollision), secondCollidingUnit(numberOfCollision)). Here's a simple diagram of how to do this to avoid double-collisions: Code:
for loop A = 1 to numberOfBalls for loop B = (A+1) to numberOfBalls check for collision between Ball(A) and Ball(B) and document it |
| 06-28-2004, 01:28 PM | #11 |
Thx for the suggestions! They are useful. I'll try again. And of course I know there are experts of triggering around. That's why I asked here! :) |
| 06-28-2004, 03:04 PM | #12 |
You know, in theory if your triggers are watertight, more than two balls can never collide simultaneously because triggers are single-threaded (i.e. it works only ONE thing out after another). |
| 06-28-2004, 04:16 PM | #13 |
That is true, but his triggers don't run whenever a unit comes in range, but are instead fast periodic triggers that check if units already are in range. That means that when the triggers check, there might be multiple collisions (units in range) that have occured in the past 0.1 seconds or whatever the frequency of the trigger is. Of course, if you have an array of units that may collide, and for each unit you only check collision with those that have a higher array number, then it is impossible to get the same collision calculated twice (except if, for some reason, in the next 0.1 seconds, the two units don't get out of each other's range; that is unlikely, though, because if they have the same mass, then their relative velocity to one another remains the same after collision, so if they had less than 0.1 second to come together, they will surely have enough time to come apart untill the next collision check; so the only way for double collision to happen would be if multiple balls collided in a wierd way) |
