Setting velocity for an actor to make it move in a certain direction

Hi.

I’m developing my first game in UE4, coming straight from unity. I just wanted to know if there is a way to set the velocity for a game object or actor like it is done in unity, where basically velocity is a rigidbody property of a game object, it is a vector and if u set it, the game object will move in the direction and with the magnitude that you specified in the vector you pass to the velocity.

Now I am wondering if it is possible to do the same thing in ue4 or do I have to create my own functions to make an actor move in a certain direction over time. At the same time I also want my actor to detect collisions which is why I am worried about creating my own translation function for the actor because if I do that, maybe collisions will not be registered or even if they are, the actor might just continue to move through the object it’s colliding with. I understand that I can program functionality in my actor to maybe bounce or stop or change direction when it collides with something but then what are the physics properties for? Basically will the physics properties of an actor affect the actor if I provide my own translation function.

Just a FYI, I am making my game strictly through code for now at least and am trying to steer away from blueprints and so far the only vaguely similar questions I’ve found to mine have answers in blueprint. Basically right now I’m trying to create a ball actor that moves in a certain direction until it hits a wall at which point it will not bounce but deflect in a random direction.

Any helpful answers will be greatly appreciated as I’m struggling to wrap my head around UE4 in general as well as it’s programming api even though I am a C++ programmer before being a C# programmer for unity.

EDIT: I am still very new to UE4(3rd day using it), so dumbed down answers would be even more helpful

just a bump to keep this relevant

I think this should help: A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums

This looks like it is used for the player controlled object class. I’m basically looking to program a non player controlled object to move on it’s own and do detect and react to collisions.

Try looking at UProjectileMovementComponent

I’ll look into that. I’ll update my findings once I do

i did a really basic test with that and it is just the thing im looking for. If anything changed during actual implementation, ill post another comment but for now this should do.

hi Alieninsame, I have the same problem about how to change velocity of a character, I have tried using Mesh->SetLinearVelocity() and Mesh->AddForce(), but still no motion of my character, do you have the answer?

I’ve not worked with that project or UE4 in quite a while but I will try to answer your question best I can.
As I remember, for my project I was not using the Character class but just the Actor class and I initialized UProjectileMovementComponent into it. The way that I changed velocity was by updating the Velocity property in the UProjectileMovementComponent.
newMovement->Velocity = FVector(0.f, 0.f, 0.f);

I have not worked with the Character class however, so I don’t know how it would work with a character if you have to use that class.