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"

Portal-like Game: Portal placing and rotation

Hi,

im new to UE4 and Visual Scripting and i try to build a portal-like game. So i have some issues with shooting the portals to an Object. 1) I created the Portal-Blueprints with a collisionBox and a cylinder. If i shot them to any wall, cube oder something else, the portal is created but it appears skewed, based on the shooting direction to the object alt text 2) If i teleport between the two portals, i always come outside of the second portal in the direction i walked into the first one. This is a key issue if i create the portals and they are on the same direction. It means i enter the first one and face the other one directly after the teleport.

There are a few other issues right know, but i really have to fix those two asap :) I hope someone can help me :)

The missing node on the left side is a OnHit-Node: alt text alt text

Product Version: UE 4.13
Tags:
portalplaced.png (744.6 kB)
blueportalshoot.jpg (126.5 kB)
portalviewport.jpg (101.9 kB)
more ▼

asked Dec 07 '16 at 07:11 PM in Blueprint Scripting

avatar image

Laliluxx
1 2

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

2 answers: sort voted first

When spawning the portal, you're currently setting its rotation to match that of the player. Instead, you should be spawning the portal so that its rotation matches the normal of the wall.

I assume you're doing some sort of collision trace when the player shots out the portal. On that node, there will be a "Hit" or "Hit Result" struct output pin. If you break that, one of the results will be a Normal Vector, which will be a vector facing directly away from the collision where the trace hit. Align your portal with that, instead. (There will be a bunch of functions to convert a direction vector into a rotator or quat you can use for spawning the portal.) Your life will be easier if you rotate your portal asset so it faces down the X axis.

For the teleport facing issue, you'll want to: - Get the relative transform of the player from the portal they're entering. There's a ConvertTransformToRelative function that will do this for you. - Calculate a new transform for the player by multiplying the relative transform by the transform of the exit portal. (In BP, the node you want is called Compose Transforms, I believe. You'll want the relative transform from the first portal hooked up to the A pin, and the transform of the exit portal on the B pin). This will create a final transform which is is in the same place relative to the exit portal as the player was relative to the entrance portal. - Next, you'll want to make the player face the opposite direction, so they'll be exiting the exit portal. Add a local rotation of 180o about yaw to the transform. - Teleport the player to this new transform.

more ▼

answered Dec 08 '16 at 05:57 AM

avatar image

Teiwaz
619 26 28 54

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

hey sir,

i tryed a few other ways and im kinda fine now, but i also got another big problem now. When i teleport between portals, generally the facing issue is solved. But if there is a portal on the ground and i "step outside" a portal on the ground, my camera is completly messed up (see screenshot). I tryed so hard to solve this issue but without any success. I also tryed ur method with the transforms... i cant get it working, im not pretty sure which transforms i should do with the convertTransformToRelative and the ComposeTransform Methods. I feel pretty dumb, tho... Here also an actuall screenshot of my TeleportTo function (It teleports me to the other portal via reference. The Target Arrow is a arrow, connected with the portal). Cheersalt text alt text

more ▼

answered Feb 06 '17 at 11:33 PM

avatar image

Laliluxx
1 2

(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