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"

Stop pawn Character Movement (Blueprints)

Hi there everyone.

I'm making my first simple game in UE4 and I'm making a Ball roller. The game works with moment along the camera angle using the Forward and Right Vectors, example below. alt text

Now i want to create a stop function when the control button is pressed so i can jump from Platform to Platform and not roll off the end.

I came up with the Idea to get the current Forward Vector and - it from its self * 2 so I would get the negative value. This would then be multiplied by the moment speed and plugged into the Impulse vector input.

This is what I have so far.alt text

Any ideas on how I could accomplish this ?

Product Version: UE 4.15
Tags:
movment.png (329.8 kB)
stop-movment.png (262.9 kB)
more ▼

asked May 11 '17 at 05:35 AM in Blueprint Scripting

avatar image

JodyLS27
5 2 5 5

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

2 answers: sort voted first

As I know, rolling template project uses AddTorque to control forward/backward movement.

Maybe it is better to start from there?

It is also possible to use rotating movement component to create rolling behavior. Did you tried it?

I'm really not sure it is a good idea to use physics forces for that. It may produce unexpected behavior.

I tried to play with physics actors and change their velocity on fly, and everything I can to advice is to use SetPhysicsLinearVelocity and SetPhysicsAngularVelocity.

Hope it helps.

more ▼

answered May 11 '17 at 08:07 AM

avatar image

redbox
4.3k 81 19 104

avatar image JodyLS27 May 11 '17 at 10:23 AM

Hi there, thanks for the feedback. At first i worked with the rolling template but decided to create it from scratch so i could learn better.

I havent tried the Rotating Movement Component yet, ill look into this. So using addForce is no good ? what would be a scenario to use it so i may understand it better ?

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

You could also try getting the linear velocity of the ball via the "Get Physics Linear Velocity" node and then adding a force opposite that every tick until the ball stops moving.alt text

stopmovement.jpg (125.6 kB)
more ▼

answered May 11 '17 at 08:18 AM

avatar image

Rabbit Man
6 1 1

avatar image JodyLS27 May 11 '17 at 10:31 AM

Hi there and thanks for the feedback.

I'm just having a quick look and one thing throwing me off is the node between "Get Physics Linear Velocity" and the Branch in front. What is the purpose of that node ?

Just reading your code backwards, if the velocity of the Sphere is == 0, 0, 0, then stop movement = false else subtract 1000 from the Current Velocity to slow down the ball, correct ?

avatar image Rabbit Man May 11 '17 at 11:27 AM

Yea, that's it. Otherwise it will keep getting impulses in opposite directions which will be a waste of resources. It is also needed to reset the variable that tells it to stop.

avatar image JodyLS27 May 14 '17 at 11:42 AM

I see. I will give this a go. Thanks so much.

(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