Anybody can help me with linepick ?
Blitz3D Forums/Blitz3D Programming/Anybody can help me with linepick ?
| ||
Hi :) I'm trying to make a very simple IA for a little game. But i don't understand how to turn smoothly my balls :) http://www.blitz3dfr.com/tempo/IA_Test.rar |
| ||
OK, I can't test where I am now, so I'm going to have a guess at this for you: Do two LinePicks at 45 degree angles in the direction the ball is going- (One to the left and one to the right) Get the Local X coordinate of the pickedx() using Tformpoint. if you add the Local X of the left collision to the local X of the right hand collision you should end up with a value you can use to turn the object by to avoid hitting things. I use this technique as part of my Car AI in the racer and it works well :) Now I just hope this is of use as I can't tell what your actually after ;) |
| ||
Any chances to see code ? :) |
| ||
C'mon Filax, I know you can do this :) I don't have blitz3D available anymore (for the mean time) but you should be able to work it out. the easier option is to simply parent two pivots on the ball, and move one out by (-10,0,10) and one out by (10,0,10). the next frame they will have collided with the scenery and you can get their X values by simply doing "EntityX" on them :). after you finish, position them both back at 0,0,0 and call ResetEntity on them :) I will try to grab code later but not for some time :) |
| ||
ResetEntity ? i'm not using blitz collision :) ? just a linepick, but my problem is that i made a turn entity to change they directions, but i want to turn them but with smooth :) So , many thanks by advance if you can help me Cygnus :) |
| ||
errrm, turning smoothly my balls is pretty easy ;-) just take your fingers and go ahead ;) |
| ||
Lol :) sure :) |
| ||
Hold on a minute, you are bouncing these things of the wall like a nutter: P\New_Yaw#=180+Rnd(-100,100) That's hardly going to give a smooth turn. You are bouncing them off the walls on a random trajectory. 'AligntoVector' that's what I would use. |
| ||
Hi Filax, i cant view the example (havent got rar on this machne) Are you trying to bounce a ball? wouldnt it be easier to linepick in the balls direction and use picked nx,ny,nz to alight a pivot to the rebounding surface at pickedx,y,z. Then do some maths to work out the balls rotation to the pivot's. From this you could work out the rebounding angle with mabe a rnd(-.5,.5) degree of chaos added so its not a 'perfect' rebound. I think you would mabe need 2 from each edge of the ball rather than its center to detect the edges collision or mabe all 3 (thinking of head on). Im not sure about the radius option, mabe slow (never used it) ie: ||| ||| 'O' |
| ||
Hi guys ! Thanks for reply :) Here is the file in zip format www.blitz3dfr.com/tempo/IA_Test.zip No, the bounce is not directly my problem, it seem work correctly. My problem come from my turn (when balls hit wall or other ball) actualy i made a quick turn entity but it's not nice :/ Is there a possibility to turn this entities slowly ? |
| ||
Salut Filax, Essaye ca: http://www.overdozing.com/IA_Test.rar |
| ||
Excellent !! merci !! :) Content de voir des amis francophone ici :) |
| ||
Bin disont on se connait deja lol ^^ |
| ||
Ah ! lol :) je vieilli :) sinon super ton patch ! je vais remettre un coup de peinture dessus et je et reposterais le truc car j'ai dans l'id�e de faire une petite lib d'IA en open source :) |
| ||
Haha, seems you weren't doing what I thought you were at all :) |