# ProjectileMovementComponent-\>SetVelocityInLocalSpace() is not consistent

**URL:** <https://forums.unrealengine.com/t/projectilemovementcomponent-setvelocityinlocalspace-is-not-consistent/448464>\
**Category:** World Creation\
**Tags:** projectilemovement, unreal-engine, Physics, velocity, Scripting, question, Blueprint\
**Created:** [May 6, 2019, 8:16am UTC](https://forums.unrealengine.com/t/projectilemovementcomponent-setvelocityinlocalspace-is-not-consistent/448464 "2019-05-06T08:16:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![XynanXDB](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@XynanXDB](https://forums.unrealengine.com/u/XynanXDB)\
**Post date:** [May 6, 2019, 8:16am UTC](https://forums.unrealengine.com/t/projectilemovementcomponent-setvelocityinlocalspace-is-not-consistent/448464/1 "2019-05-06T08:16:38Z")

</div>

Hi, currently I’m making a grappling hook when I prespawn the hook in front of my gun, shoot it, add velocity, hit something, stop or if it gone too far it will retract back.

The hook works perfectly if I didnt hit anything, the codes below.

```
void AGrapplingHook::AddVelocityToBullet()
{
    StaticMeshComponent->DetachFromComponent(FDetachmentTransformRules::KeepWorldTransform);
    ProjectileMovementComponent->SetVelocityInLocalSpace(FVector(BulletMovementSpeed, 0, 0));
}

```

However, SetVelocityinLocalSpace stop working if I retracted the hook from a wall. Is there anyway I can set velocity multiple time?

 ![276104-untitled.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/b/c/cbc62408b313906af5b8eac64918e0d8434ec41a.png)

I tried doing it in blueprint but the velocity still stays 0,0,0 after I have retracted the hook from the wall.

Here’s the code for retract:

```
void AGrapplingHook::RetractHook(float DeltaTime)
{
    if (!IsValid(GetOwner())) { return; }

    ProjectileMovementComponent->SetVelocityInLocalSpace(FVector::ZeroVector);
    
    FTransform SpawnpointTransform = GetSpawnPointTransform();

    FVector LerpedLocation = UKismetMathLibrary::VLerp(GetActorLocation(), SpawnpointTransform.GetLocation(), DeltaTime * 30.0f);
    SetActorLocationAndRotation(LerpedLocation, SpawnpointTransform.GetRotation());

    float DistanceBetweenHookAndPlayer = UKismetMathLibrary::VSize(GetActorLocation() - SpawnpointTransform.GetLocation());

    if (UKismetMathLibrary::NearlyEqual_FloatFloat(DistanceBetweenSuctionCupAndPlayer, 0.0f, 0.5f))
    {
        AGun* Gun= Cast<AGun>(GetOwner());
        AttachToComponent(Ranged->GetSkeletalMesh(), FAttachmentTransformRules::KeepWorldTransform, Ranged->ShootSocket);
        bIsRetractHook = false;
    }
}
```
