x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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

Product Version: UE 4.9
Tags:
more ▼

asked Oct 03 '15 at 07:37 PM in C++ Programming

avatar image

Alieninsane
18 4 7 11

avatar image Alieninsane Oct 05 '15 at 04:46 PM

just a bump to keep this relevant

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first
more ▼

answered Oct 05 '15 at 05:38 PM

avatar image

lion032
981 31 80 55

avatar image Alieninsane Oct 05 '15 at 07:31 PM

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.

avatar image lion032 Oct 05 '15 at 07:40 PM

Try looking at UProjectileMovementComponent

avatar image Alieninsane Oct 05 '15 at 07:43 PM

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

avatar image Alieninsane Oct 06 '15 at 08:49 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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?

more ▼

answered Mar 09 '17 at 02:49 AM

avatar image

vectorL
1 3 2

avatar image Alieninsane Mar 09 '17 at 07:40 AM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question