Announcement

Collapse
No announcement yet.

Is there a way I can "snap" my character to a floor with any given rotation?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Is there a way I can "snap" my character to a floor with any given rotation?

    Hey guys,

    I posted this on answers.unrealengine.com as well, but I'm posting it here hoping I can find answers more quickly.

    I'm hard stuck on some issue and seek guidance to how to handle it. Note that I'm relatively new to all of this game development stuff, so if this is a silly question, I'm really sorry. I just hope I can be pointed in the right direction.

    So, here we go:
    Basically, my project consists of a map with multiple custom gravity fields. I've made 2 blueprints for that. One of them is for "room gravity" where you can set up the gravitational pull in any given relative direction (not world direction). And the secondary one "planet gravity" which is pretty self explanatory - pulls everything to the middle of the field.

    Here's a little video I made to demonstrate how they work, so you can get the feeling of it:

    https://www.youtube.com/watch?v=lqkDBwqaACM

    To make my character (which is a standard character actor) handle all the rotations and enable it to walk on any surface regardless of its world rotation, I've set its movement mode to "Flying" and set it up to kinda simulate the "Walking" mode of "CharacterMovementComponent". Now, this is all great and works relatively well.

    But the issue that I'm encountering now is with moving platforms that also simulate physics. Here's what I mean:

    https://www.youtube.com/watch?v=5ieehIFOEYU

    The platform in this video is moved forward by a thruster. As soon as my character (or any object for that matter) falls on it, the force of that object affects the platform rotation. Which is all fine and how it should be.
    But as the platform moves forward, my character or any other object just stays at it's own world position (still applying the gravity force).

    Meanwhile, if I put my character in "walking" mode, when I jump on that platform, it "snaps" to it. Moving the way the platform moves but does not apply my gravity force anymore. Here's how that goes:

    https://www.youtube.com/watch?v=-g63mjR1WpM


    But, if the platform is rotating more than the "walkable slope" angle, the character falls from it, regardless of my gravity vector, since it's only taking into account the world Z axis to calculate that. So I can't really use the "Walking" mode for what I want to do.

    So here's my question: How can I "snap" my character or any other object to a floor with any given rotation? How can I simulate the same "snap" from "Walking" mode to "Flying" mode?

    If there's a solution to this, I think that will fix my second issue with ramps (which I thought wasn't a big deal, but now that I think of it, they're connected). As my character and objects do not "snap" to the floors, they will always slide down because of the gravity force applied.

    Here's how that happens:

    https://www.youtube.com/watch?v=3vdteZeg02o


    -------------------------------------------------------------------

    I really hope you guys can help me on this or at least point me in the right direction.

    Have a wonderful day and happy coding.

    #2
    Alright, if anybody ever finds a way to make this work, please let me know.

    In the meantime, it seems that if I attach my character to the said "floor", it will also get updated with the platform's velocity if it has any.
    So I "solved" my issue that way. However, I hope there is a better way to do that. So, still looking forward to hear from some of you gurus.
    Last edited by EU_Coxis; 11-27-2017, 10:17 AM.

    Comment

    Working...
    X