Bonjour,
Comment faire pour tracer une ligne d'un actif à un autre en sachant qu'un des 2 actifs peut se déplacer (evidement la ligne doit le suivre, sinon c'est pas drôle).
Merci
Bonjour,
Comment faire pour tracer une ligne d'un actif à un autre en sachant qu'un des 2 actifs peut se déplacer (evidement la ligne doit le suivre, sinon c'est pas drôle).
Merci
C'est bon, j'ai trouvé.
C'est une ligne droite mais ca va faire le taf ^^
Pour info :
(actif, petit rectangle noir) Toujours
Fixer l'echelle en X > Sqr(( ( X( "origine" ) - X( "destination" ) ) pow 2 ) + ( ( Y( "origine" ) - Y( "destination" ) ) pow 2 ))
Fixer l'angle > ATan2(Y( "origine" ) - Y( "destination" ), X( "destination" ) - X( "origine" ))
Just to add: doing distance this way is very precise, but can be somewhat overkill for this situation
to save a little bit of processing power and make the calculation simpler, just use the built in Distance with a point expressionYou can find it under the position section of objects expressions, it takes 2 parameters, of which are the target X and Y positionsCode:ODistance( "Active", >X of point<, >Y of point< )
There is also a built-in Angle of a vector expression (found in the same section)but it’s integer based so it wil be jittery and not very accurate, not very suitable for situations like thisCode:OAngle( "Active", >X of point<, >Y of point<)
try replacing the distance calculation with the built in one and see if there is any noticeable difference, if not then just use the built in one
Hi, can you give an example .mfa ? i don't get why to use them for drawing a line.
Nice, the second method is less precise but greatly more easy to use. thanks for the example.