Click here to Skip to main content
15,849,678 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello
I have a question that i wish to answer it.
I'm vb.net programmer
Let's say that we have two objects (A,B)
how can I move object "A" from its location toward object "B" location straightly with vb.net.

And Thank You.
Posted
Updated 16-Dec-10 2:30am
v2
Comments
Toniyo Jackson 16-Dec-10 7:30am    
Spell check
#realJSOP 16-Dec-10 7:33am    
What do you mean by "move A toward B"?
Abdul Quader Mamun 16-Dec-10 7:34am    
Is these two objects in a collection?

I assume you would like to move an object towards another on screen.

Lets say object a is 100 units below object b and also 200 units right of object b. This means that for every unit a moves up it has to move 1 * (200 / 100) = 2 units to the left. This also means that for every single unit it moves to the left it has to move 1 * (100 / 200) = 0.5 units up.

Good luck!
 
Share this answer
 
Take the coordinates for both objects AX,AY and BX,BY.
Now you have to points and you linearily interpolate all
the points on the line between AX,AY and BX,BY.
Use AX,AY as start point and BX,BY as the endpoint.
Use the interpolated points to move object A towards object B.


Cheers,


Manfred
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900