different movement vectors
Imagine a static object (a line section) and a dynamic object (another line section) in 2D space. The dynamic line is moving, but both points defining the line section don''t have the same movement vector (like when it''s rotating).
Now I need one and only one movement vector of the line section for collision detection, how do I determine it from the two vectors I have?
Do you use the two Move vectors to rotate this line?
if so dont.
For example, you have a line that is
P1(-1, 0) ---X--- P2(1, 0)
P1 = Point 1; X = Center (0, 0); P2 = Point 2
you use one movment vector to just move it, (move the X that is)
and another value that will rotate it using cos/sin
example.
You want to move it 10 units up and rotate 45 degress
this you calculate like:
Translate = (0, 10);
Rotation = Cos(45*piOVER180);
NewP1 = P1 * Rotatoin + Translate;
NewP2 = P2 * Rotatoin + Translate;
Ok, im in a bit hurry, but that should work i think
The new line is:
or vice versa, cheers.
/D
fatal error C1004: unexpected end of file found
if so dont.
For example, you have a line that is
P1(-1, 0) ---X--- P2(1, 0)
P1 = Point 1; X = Center (0, 0); P2 = Point 2
you use one movment vector to just move it, (move the X that is)
and another value that will rotate it using cos/sin
example.
You want to move it 10 units up and rotate 45 degress
this you calculate like:
Translate = (0, 10);
Rotation = Cos(45*piOVER180);
NewP1 = P1 * Rotatoin + Translate;
NewP2 = P2 * Rotatoin + Translate;
Ok, im in a bit hurry, but that should work i think
The new line is:
P1 \ \ \ X \ \ \ P2---------------------------------- <- Zero ground <-
or vice versa, cheers.
/D
fatal error C1004: unexpected end of file found
Swedish: #Gamedev.se on EFNET
Well, the line isn''t rotating around its center but one of its endpoints - which itself gets translated. Now I want to do collision detection with the line, but I need one and only one movement-vector for it. But since I have to different vectors (P1 and P2)I wonder if there''s a way to get one movement vector out of the two? Or is there another way to do cd with this rotating line?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement