Is Kinematic Rigidbodies functionality valid in UE4

Takem from

UCLASS()
class AMyActor : public AActor
{
GENERATED_BODY()

UPROPERTY()
UPrimitiveComponent* PhysicalComp;

AMyActor()
{
    PhysicalComp = CreateDefaultSubobject<USphereComponent>(TEXT("CollisionAndPhysics"));
    PhysicalComp->SetSimulatePhysics(false);
    PhysicalComp->SetPhysicsLinearVelocity(GetActorRotation().Vector() * 100.0f);
}

};

Can’t make it work when simulate is set to false… Ive tried to do it purely with BP but with the same results…

Does anybody have the same problem?

You’re turning off physics then trying to apply physics. I suspect that won’t work - if physics isn’t simulating then your object won’t process the velocity.

You could make your own velocity variable and use it to translate your object by adding the velocity over one time step to the location.

Really…so it’s a mistake in official tutorial…I thought that its somehow translates speed into change of world (pure kinematic) based on speed value and delta time between frames. And, ofcourse, there are many different ways to get work done)))

And…as stated in the same tutorial (Yea, I’ve even downloaded Unity :wink:

public class MyComponent : MonoBehaviour
{
void Start()
{
    rigidbody.isKinimatic = true;
    rigidbody.velocity = transform.forward * 10.0f;
}
}

Totally valid

I see - you’re using this tutorial: Unreal Engine 4 For Unity Developers | Unreal Engine Documentation

It would seem that whoever wrote that tutorial didn’t test that code.

There’s a spelling mistake so the actual Unity code would be:

 rigidbody.isKinematic = true;
 rigidbody.velocity = transform.forward * 10.0f;

That code doesn’t work in Unity to move the object – in Unity as well, a kinematic (non-simulated) rigidbody will ignore its velocity value. Kinematic objects generally do this in all game engines – so that’s a great catch. I haven’t tested your code in Unreal but it’s not surprising to me that non-simulated objects don’t translate using that velocity.

Hopefully somebody can fix that up?

In the meanwhile, the fix I would imagine is to turn on ticks for your object (turn on can ever tick) and control the object’s location yourself in the tick function.

Now its totally clear! Thank you.