Announcement

Collapse
No announcement yet.

Trying to place actor on walls/floors via line trace but keep getting the wrong rotation

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

    Trying to place actor on walls/floors via line trace but keep getting the wrong rotation

    I am making a little "Portal" project where I am trying to replicate the mechanics of VALVE's "Portal" game and I am currently trying to write the logic for placing portals on walls/floors (via line trace, essentially "shooting" them unto a wall). The position ends up being correct but the rotation is wrong.

    It's kind of hard to explain the issue so I recorded a video to showcase it: https://www.youtube.com/watch?v=7BqP6caUQHk

    In the video you can see that the portal has the same rotation when placing it regardless of where the player is standing. The correct behavior I want is for the bottom of the portal to always face the player while still remaining flat on the ground.

    Here is my current blueprint logic: https://i.imgur.com/t7DjzVP.png

    I know that I need to somehow rotate the portal in one axis to face the player so that it still remains flat on the ground... I just can't seem to figure out how. I have tried multiple solution but have never gotten it to work the way I want to. Help?

    #2
    Honestly, I don't think you should change it. The way it works now is exactly how I would expect it to work when looking through a window. Place a portal on a wall and walk around it. What does that look like? Rifts and portals and tears through space and time. They are not moveable. Once placed they should not rotate to face the player. Just my 2 cents.

    If you must do this I would look at the interp to nodes and see if you can get the current portal transform and interp to the current player transform. obiviously you would want to break the rotation and only rotate around z using degrees possibly.

    Comment


      #3
      Originally posted by xpgained View Post
      Honestly, I don't think you should change it. The way it works now is exactly how I would expect it to work when looking through a window. Place a portal on a wall and walk around it. What does that look like? Rifts and portals and tears through space and time. They are not moveable. Once placed they should not rotate to face the player. Just my 2 cents.

      If you must do this I would look at the interp to nodes and see if you can get the current portal transform and interp to the current player transform. obiviously you would want to break the rotation and only rotate around z using degrees possibly.
      Yes, I agree, logically it should be that way but making the portals bottom edge face the player when placed on a ceiling or floor makes it easier for the player to "play the game". It's more of a design choice then trying to be realistic. For example, if VALVE didn't rotate the portals in their "Portal" game when players put them on a floor or ceiling, it would be very hard to fling yourself across the room by jumping straight down into a portal from a height (which is a big part of the "Portal" series) as players would likely miss the portal due to improper rotation.

      Anyway, I managed to solve this issue myself. Here is the final blueprint for the rotation calculation:

      Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	144.8 KB
ID:	1663978

      Comment

      Working...
      X