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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

Is it possible to get the real forward direction of a ball (rolling template)?

As I understand it the "Get Forward Velocity" node won't work like it would for most other game modes. The actor that we're controlling is continuously experiencing torque, where the forward vector of the mesh is always spinning. Is there a way to get the real movement direction efficiently? I would use this for a couple of things, mostly I need to do line traces in front of the ball to test for viable places to jump, I'd also like to make the camera lerp forward (my game is 2.5d) when the ball gets going faster (so the player can see more in front of the ball), basically the inverse of the "drag" found on the Spring Arm component.

My current and only theory was to get the actor's location and store it as "previous location" and then use a trace to the "current location", allowing me to determine the true direction of the ball's movement. Then I would be able to add a point in front of the ball regardless of what direction its going. Does that sound reasonable? Or is there a much easier way?

Product Version: UE 4.9
more ▼

asked Oct 10 '15 at 01:46 AM in Blueprint Scripting

avatar image

81 15 19 25

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

The answer for anyone else looking is to get the physics linear velocity of the ball. Since we can't get its actual facing direction or what not we must get its movement direction with the physics node. I was then able to normalize it, multiply it by a distance, add it to its own world location and use that to project a point in space at all times in front of my ball. alt text

image 023.png (93.1 kB)
more ▼

answered Oct 13 '15 at 03:57 PM

avatar image

81 15 19 25

(comments are locked)
10|2000 characters needed characters left

I think Get Forward Vector was what you were looking for

more ▼

answered Oct 22 '15 at 04:58 AM

avatar image

171 9 16 30

avatar image sarchasm Oct 22 '15 at 08:07 PM

See answer above.

avatar image TheFoyer Oct 22 '15 at 08:13 PM

But Get Forward Vector is what you want for: "where the forward vector of the mesh is always spinning"

avatar image sarchasm Oct 22 '15 at 09:03 PM

The mesh is always spinning, so if we got its forward facing vector we'd get 360 different angles of whatever axis its turning on. When we get physics linear velocity we actually get the direction the ball is going (ie its actual forward). Think of a tire on a car, just because we say X is its forward direction, as soon as the car starts moving it'll be looking down, behind, up, and "forward" again constantly.

avatar image TheFoyer Oct 22 '15 at 10:10 PM

Yeah you're right, I thought it would get the directional vector of the physics object but it totally doesn't work like I thought it did. Though while testing this I got some pretty cool looking geometric shapes with line trace

(comments are locked)
10|2000 characters needed characters left
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