# umen242

Member

108

264 Neutral

• Rank
Member
1. ## How to calculate the vector direction to point , so the object will move to

Thanks allot for the help i got it solved i have another question that is related How to detect when object A In point B place  i have object which is moving to points in the screen each time the point ( call it B)  is moving to different place and object A follow its direction .  Im using Linear interpolation and simple pythagoras equation to find the vector to point B what i have problem now is to find the location where object A should stop when it In point B place  point B its just x/y location . point b can be any where on the screen   [attachment=36229:touch.png]

3. ## How to calculate the vector direction to point , so the object will move to

i like to be able to calculate the vector values from object A to destination position. For Example in this image object A to destination B . What will be the x/y positions all the way until it reach distention B. where the x,y origin is in bottom left side     [attachment=36227:vecmove.png]
4. ## Do you have any info on how the Character animation done in the game Vector ?

Hello The character animation in the game vector is amazing . does any body knows how it done? Thanks
5. ## How to make snake movement smooth not grid based like stihter io snake

Hello all i try to find the right formula to mimic the smooth none grid movement of the stihter io snake  . i can do it manually to save each point the "head" movement  went and do some interpolation in between its body parts but it is very error prone. also i find this : http://www.emanueleferonato.com/2014/06/10/html5-string-avoider-game-made-with-phaser/  which is not working in my case but do show something similar  here is a picture to express what i want to do :    [sharedmedia=core:attachments:33572]     any idea how to do it right ?  Thanks!

Thanks all!
7. ## How to calcolate moving vector of object by its rotation degress in 2d

Thanks for the replay , but can you please explain more , or can you can you please direct me to some links to explain ?
8. ## How to calcolate moving vector of object by its rotation degress in 2d

Hello all i have object in game which is rotating when i move my joystick , now i need to calculate its movement vector by its rotation  the object always moving forward and controlled by the joystick , the joystick is only setting its direction by degree .  here is the image which illustrate the scene .  i need some formula of the vector which the object will move . [sharedmedia=core:attachments:33561] Thanks
9. ## How to detect diamond shape collision detection , if object is inside the diamond

yes i notice it sometimes above 1 and sometimes below ...  wow .. it is not consist ..
10. ## How to detect diamond shape collision detection , if object is inside the diamond

Ok i think i got this working with your fix  Thanks allot  Also Question while searching about the subject how about checking if point inside triangle using one of those methods here ? http://stackoverflow.com/questions/2049582/how-to-determine-if-a-point-is-in-a-2d-triangle
11. ## How to detect diamond shape collision detection , if object is inside the diamond

sorry i misunderstand this wired python syntax ... so how should this: return 1 - xfrac + yfrac <= 1 look like on simple C code ?
12. ## How to detect diamond shape collision detection , if object is inside the diamond

Im trying to implement it now , say didn't you meant  Inside calculation for rectangles 2 and 3 ? as it substract from 1 first ?   i have test case im working on on some cases it works in some it doesn't see what i mean :  based on your code example i did :    bool game::insideOfTri(float left, float top, float right, float bottom, float dotx, float doty, bool type) { if (left < right && bottom < top) { float xsize = right - left; float ysize = top - bottom; float dot_lcl_x = dotx - left; float dot_lcl_y = doty - bottom; float dot_lcl_x_f = dot_lcl_x / xsize; float dot_lcl_y_f = dot_lcl_y / ysize; float result = 0; if (type) { result = 1 - (dot_lcl_x_f + dot_lcl_y_f); } else { result = (dot_lcl_x_f + dot_lcl_y_f); } if (result >= 1) { return true; } return false; } using this function : where parameters are :  left : 160.0 right :201.0 top:330.5 bottom:310.0 dotx:160.0 doty:315.0   the result of dot_lcl_x is : 0 which is true the result of dot_lcl_y is 5 which is true  and the expected return from the function is true . but if i continue the calculation in the function  dot_lcl_x_f is 0 and  dot_lcl_y_f is 0.24 so no matter which calculations  if it : result = 1 - (dot_lcl_x_f + dot_lcl_y_f); or  result = (dot_lcl_x_f + dot_lcl_y_f); will give false . which is wrong  so when i calculating rectangle number 2 it gives me false  when i calculating rectangle number 1 the calculation is right and it gives me true . so as you can see the problem is that dotx:160.0 - left : 160.0 = 0 , so it never be above 1    [sharedmedia=core:attachments:33360]
13. ## How to detect diamond shape collision detection , if object is inside the diamond

@Alberth Thanks allot ! yo uare helping me allot and i feel i getting there .  Few Things i dont understand . 1. what do you mean :   what is : "w.r.t" ?    2. as i have the points calculated , do i need to set the and calculate the point inside the triangle part of the rectangle ; from world space to local space  what i mean is see the picture  :   [sharedmedia=core:attachments:33336] There is local space of the blue dot , do i need to convert it to local space so it will be relative to its one of the 4 rectangles?  so each time it will be calculated from the rectangles X.Y coordinates ?  and not from the world space ( screen ) coordinates ?   im alittle bit confuse here .. what is the proper way to calculate it .
14. ## How to detect diamond shape collision detection , if object is inside the diamond

@Alberth   Question  im try to implement the method you show me  the problem is that in my case the 0,0 coordinates are from bottom left of the rectangle  the first formula (x/x_size) + (y/y_size) working great    but the second one with (1-x) doesn't work . how can i change it to work with my coordinates ? also  now i just noticed that i need to reset on each part of the rectangles the x and y position to 0,0 from it world coordinates .. this is way to much work ...   Thanks!
15. ## How to detect diamond shape collision detection , if object is inside the diamond

Thanks!! Sorry , in the last explanation i didn't understand what is: c?  what points ? can you please give simple example ?  Thanks again !