So i have been trying to get my first person character to move to the location inside of the vent as the character itself is to big to crouch and walk in. so i have made another camera and on interaction with the vent i blend to the other camera . This does not give control as its not my Pawn. What is the best way to do this instead? so that the chaacter would be able to move inside in a straight and backward axis thanks
I made a blueprint of a collision box “vent” so that i can trigger the function.
The Function to change cameras.
I would not do it this way to be honest. If you really want you might be able to move that camera by changing its world location while holding a certain key. This would require you to get the reference to the camera object that you are switching to either from your character or from the player controller. Then while the required key is pressed you’d always add some value to the world location of the desired axis which would eventually move the camera (you’d probably need to interpolate the value to make it look smooth).
What I would do is just disable collision for the character, make his capsule smaller or disable collision too, made at least some animation to make it look like the character is laying (not required, you can also just hide the character mesh while it is supposed to be in the vent) and than you can easily control the capsule of the character like normally.
I am sorry that I can not explain more thoroughly but it would take me an hour to fully explain here
Thanks for the speedy reply. Yes that sounds like the best way to do it. The only thing is how do i move the Whole character inside the vent like the last picture shows.
You’ll have to play with any idea that comes to your mind. It is just about that really. It is not like I’ve ever done this .
What I would try though if I was to implement this right now is:
You do not probably need a blueprint for the vent itself… if the vent is a static mesh with proper collision setup (which means that the collision is just on the walls of the vent not inside the vent)
I don’t know how you go about getting into the vent but I would do it so when you interact with the vent I would disable controls for the character, disable collisions and probably just leave the collision for the capsule itself, make the capsule smaller to fit the vent perfectly.
Then I would make a smooth transition of the character to the starting point of the vent and after it is completed I would enable controls to just move forward / backward.
Ofc you would then need to create some triggers so that when you move back too much you would transition back to where you started or when you reach the end you would transition out of the other end of the vent etc.
It seems like a very easy thing to do, you might just need to play with it a bit to make it suit your needs really
So I’ve put this together quickly for you and it was even easier than I thought at first. I don’t know if something like this is interesting for you. If so let me know and I’ll post here how to do it.
Ofc you would add more functionality to it like limit the movement, change speed, hide character mesh etc…
So I created a BP_Vent for it eventually and added the following components:
Cubes (to form the vent structure)
Two collision boxes, one for entry and one for exit (To trigger an event to enter/leave the vent, you might want to make them two-sided though which is easy, you would just use something like “isInVent boolean variable” and alter the functionality based on this variable)
Two scene components, one for entry and one for exit (Defines the location, where you want to teleport the player)
Then in your Character BP create a function that handles entering/leaving the vent. I realized that the mesh itself by default does not collide with the environment, so the functionality is really basic. You just make the capsule smaller to fit the vent and teleport the character inside.
Everything works well. Thanks for taking your time to come up with a way of doing it. i cant seem to add a local offset to the FirstpersonCamera on the Z axis to compensate for the height. (The camera is above the vent while player is in.)
I don’t know, what exactly is not working for you? You can either add Local Offset (to move certain amount up/down) or Set relative Location to set it exactly where you want.
My camera does not move down like your in this video, even with the correct adjustments. i must be doing something so simple that is wrong but do not see
I do not know how you control the camera (or even the character) Something is definitely interfering with it, you should be able to change its relative location without any issue. Did you try that? “Set Relative Location” instead of adding offset? You can also try to add some extreme values like -1000 to see if it will move down, it can be that the camera collides with the vent so it goes above it (even though it should not since it is not placed on a SpringArm)