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"

Detaching Actor resets velocity

Hello, I'm working on a platformer wherein the player can grab onto and swing on vines (forwards and backwards for now). Currently I have to attach the player character to a rope component (a series of static meshes linked together by physics constraints) but when I detach the player character from the rope component, the player velocity is zeroed and so doesn't transfer momentum, whereas I need that so that they can launch into other vines and so. I've posted a picture of the before/after code.

Attaching: alt textalt text

Detaching: alt textalt text

From what I understand this zeroing occurs when detaching the actor from the other actor, I also have a Vector which is being set to the vine component's current velocity as well. I was wondering if anyone knew a way to remove this zeroing or override it somehow.

Product Version: UE 4.11
Tags:
more ▼

asked Aug 07 '16 at 05:18 PM in Blueprint Scripting

avatar image

oddalicious
3 1 2 4

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

1 answer: sort voted first

As far as I know you can not use attach/detach when you want to preserve momentum like that. You would have to add force through some function after detaching manually.

To keep momentum you have to use a physics handle. With that you can do exactly what you want.

more ▼

answered Aug 07 '16 at 05:45 PM

avatar image

NoobsDeSroobs
2.7k 107 35 180

avatar image oddalicious Aug 08 '16 at 06:24 AM

That worked great, thanks :)

avatar image Tamlin Oct 06 '17 at 01:14 PM

You can actually use attach/detach and still preserve momentum. I'm doing exactly that in my current project and it works fine. UNTIL I also added collision response on/off.

If I only toggle physics simulation on attach/detach, then it works fine and momentum is preserved when releasing the actor. But if I also toggle collision on/off, then momentum resets. It doesn't matter which order I do it in - if I detach first and then toggle collision or the other way around, or if I toggle physics first and then collision or the other way around - however I do it the momentum always resets if I touch the collision setting.

At the start of this project we used physics handles but it was very unreliable and didn't feel very responsive in VR, so we switched to attach/detach and it immediately worked MUCH better, especially in VR.

How did you manage to make it work great using physics handles?

avatar image RVillani Nov 24 '17 at 01:02 AM

Tamlin, thank you! You just solved my momentum problem in VR. I was toggling collision. Now I just change Collision response to specific channels usign Set Collision Response to Channel and it works flawlessly.

I still use physics handle, but for opening drawers, cabinets etc. But for stuff supposed to be held in hand, it's too laggy.

(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