I'm working at getting a coded movie clip with two points that can have differing speeds, but still remain the same distance apart and react to things like collisions (think Sprint pin-drop logo). I originally gave each point its own speed and angle, but the object would do a 180 degree turn if the two angles were ever facing eachother with high enough speeds, along with some other unnatural effects. I decided to simplified it to a "width" component that goes paralell to the line between the two points, and two components perpindicular to that line, situated at each point, called "left" and "right". Adding gravity, which works by taking the sine value of the angle, works fine, but things start getting strange if you add any rotation to it. Since the speeds created by gravity change direction, the object will start going off to the side and never falling.
Here's the SWF. Changing any of the variables will reset the object.
http://nialsh.scehardt.com/points.html
Here's all my code except for the arrow functions.
code:
resetVars();
width_txt.onChanged = function(){
resetVars();
}
right_txt.onChanged = function(){
resetVars();
}
left_txt.onChanged = function(){
resetVars();
}
function resetVars(){
widthSpeed = Number(width_txt.text);
leftSpeed = Number(left_txt.text);
rightSpeed = Number(right_txt.text);
xPosLeft = 100;
yPosLeft = 50;
xPosRight = 150;
yPosRight = 50;
}
this.onEnterFrame = function(){
angle = Math.atan2(yPosRight-yPosLeft,xPosRight-xPosLeft);
widthSpeed += Math.sin(angle)/4;
leftSpeed += Math.sin(angle-Math.PI/2)/4;
rightSpeed += Math.sin(angle-Math.PI/2)/4;
xPosLeft += Math.cos(angle)*widthSpeed+Math.cos(angle-Math.PI/2)*leftSpeed;
xPosRight += Math.cos(angle)*widthSpeed+Math.cos(angle-Math.PI/2)*rightSpeed;
yPosLeft += Math.sin(angle)*widthSpeed+Math.sin(angle-Math.PI/2)*leftSpeed;
yPosRight += Math.sin(angle)*widthSpeed+Math.sin(angle-Math.PI/2)*rightSpeed;
my_mc._x = (xPosLeft+xPosRight)/2;
my_mc._y = (yPosLeft+yPosRight)/2;
angle = Math.atan2(yPosRight-yPosLeft,xPosRight-xPosLeft);
xTemp = Math.cos(angle);
yTemp = Math.sin(angle);
xPosLeft = xTemp*-25+my_mc._x;
yPosLeft = yTemp*-25+my_mc._y;
xPosRight = xTemp*25+my_mc._x;
yPosRight = yTemp*25+my_mc._y;
my_mc._rotation = angle*180/Math.PI;
radArrow(my_mc._x,my_mc._y,angle,widthSpeed*20,fal se);
angle = Math.atan2(yPosRight-yPosLeft,xPosRight-xPosLeft);
radArrow(xPosLeft,yPosLeft,angle-Math.PI/2,leftSpeed*10,false);
angle = Math.atan2(yPosRight-yPosLeft,xPosRight-xPosLeft);
radArrow(xPosRight,yPosRight,angle-Math.PI/2,rightSpeed*10,false);
}


Thanks to anyone can offer help or some code related to this.

Neal