improved suckiness of scoops
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@356 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
90036c01bf
commit
4938264869
@ -2135,17 +2135,26 @@ BOOL ship_canCollide (ShipEntity* ship)
|
|||||||
desired_speed = 0.0;
|
desired_speed = 0.0;
|
||||||
desired_range = collision_radius;
|
desired_range = collision_radius;
|
||||||
destination = [hauler absoluteTractorPosition];
|
destination = [hauler absoluteTractorPosition];
|
||||||
// adjust for difference in velocity
|
// adjust for difference in velocity (spring rule)
|
||||||
Vector dv = vector_between( [self getVelocity], [hauler getVelocity]);
|
Vector dv = vector_between( [self getVelocity], [hauler getVelocity]);
|
||||||
velocity.x += delta_t * dv.x * 0.25 * tf;
|
velocity.x += delta_t * dv.x * 0.25 * tf;
|
||||||
velocity.y += delta_t * dv.y * 0.25 * tf;
|
velocity.y += delta_t * dv.y * 0.25 * tf;
|
||||||
velocity.z += delta_t * dv.z * 0.25 * tf;
|
velocity.z += delta_t * dv.z * 0.25 * tf;
|
||||||
// force is proportional to distance
|
|
||||||
// acceleration = force / mass
|
// acceleration = force / mass
|
||||||
|
// force proportional to distance (spring rule)
|
||||||
Vector dp = vector_between( position, destination);
|
Vector dp = vector_between( position, destination);
|
||||||
velocity.x += delta_t * dp.x * tf;
|
velocity.x += delta_t * dp.x * tf;
|
||||||
velocity.y += delta_t * dp.y * tf;
|
velocity.y += delta_t * dp.y * tf;
|
||||||
velocity.z += delta_t * dp.z * tf;
|
velocity.z += delta_t * dp.z * tf;
|
||||||
|
// force inversely proportional to distance
|
||||||
|
GLfloat d2 = magnitude2(dp);
|
||||||
|
if (d2 > 0.0)
|
||||||
|
{
|
||||||
|
velocity.x += delta_t * dp.x * tf / d2;
|
||||||
|
velocity.y += delta_t * dp.y * tf / d2;
|
||||||
|
velocity.z += delta_t * dp.z * tf / d2;
|
||||||
|
}
|
||||||
|
|
||||||
thrust = 10.0; // used to damp velocity
|
thrust = 10.0; // used to damp velocity
|
||||||
if (status == STATUS_BEING_SCOOPED)
|
if (status == STATUS_BEING_SCOOPED)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user