# How to set "APPLY_FORCE_TO_ENTITY" to send vehicle A to arrive object B with given coordinates?

• I want apply a force to Vehicle A which is at the given coordinates to move it toward object B which is at those given coordinates!
The force should be applied until vehicle A reaches object B.
And can I set how long time(how fast) it need to arrive at object B's position.
example:

vehicle A coordinates:
coordsA = Vector3();
coordsA.x = 100.0f;
coordsA.y = -500.0f;
coordsA.z = 50.0f;

object B coordinates:
coordsB = Vector3();
coordsB.x = -400.0f;
coordsB.y = 200.0f;
coordsB.z = 40.0f;

``static void APPLY_FORCE_TO_ENTITY(Entity entity, int forceFlags, float x, float y, float z, float offX, float offY, float offZ, int boneIndex, BOOL isDirectionRel, BOOL ignoreUpVec, BOOL isForceRel, BOOL p12, BOOL p13) { invoke<Void>(0xC5F68BE9613E2D18, entity, forceFlags, x, y, z, offX, offY, offZ, boneIndex, isDirectionRel, ignoreUpVec, isForceRel, p12, p13); } // 0xC5F68BE9613E2D18 0xC1C0855A``

• Get the direction from coordA to coordB. Multiply the result by a float value for more force.

``````Vector3 direction = (coordB - coordA).Normalized;

vehicleA.ApplyForce(direction * 5f);
``````

• @stillhere I got this error if I use Vector3 direction = (coordB - coordA).Normalized; Did you know why?

• @Shira-Brixx C++ I assume? I guess the Vector3 class you're using does not have an operator for subtracting two vectors. Check out SlimDX's Vector3.h and Vector3.cpp.

• @stillhere ty for your help

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.