Capsule component to Camera (VIVE)

Is there anyway to keep the capsule component aligned with the camera?

Currently the camera is walking away from the capsule component and any enemies that are setup to attack a certain player will just attack the now empty capsule component.

I made a temporary workaround by spawning a new actor from type ‘pawn’ in my character blueprint. Then I called the called the player controller and possessed that new pawn from, all from the character blueprint.

From this point you can set the original character it’s location to the newly possessed pawn’s location.

I’ve attached some screenshots, in case anybody else is struggling. There should really be an easier/better way to do this, but I haven’t found it yet.

I made a component that pretty much does the same thing, then I just attach whatever I want to follow the camera to that component.

I actually found a far better solution, as possessing a new character brought along some new issues.

Upon spawning the character I spawn a new custom ‘CameraActor’ blueprint. I drag out from the camera actor in the controller and call ‘set view target with blend’. - this is all done from my player controller.

In the CameraActor blueprint I pretty much do the same thing as before and call the ‘WorldLocation & Rotation’ from the camera component. I then again just set the location of my character to the location of the CameraActor’s CameraComponent Location.

I found this works a lot better for me because I don’t have to deal with unpossessing the new pawn etc, this kinda broke respawns for me.

This took far too long to figure out I tried about 50 different methods. There should really be an easier way to keep the capsule component of a character with the HMD’s world position without having to resort to all this craziness.

Thats what I meant, I attach the capsule component of the pawn to the component regulating the location relative to the camera. The root of the character is just a scene component.

I don’t exactly understand how you do this. Could you post some screenshot?
Sorry for that question, but I am a beginner and have the exact same problem.

I had similar issue with collision to be precise. I’m developing runner type of game and wanted to avoid any obstacles simply by moving left or right. However default capsule collision were staying at 0,0,0 location and even though player moved capsule stayed in one place and interacted with anything crossing it’s path in the middle of the room. My workaround was to simply set collisions to none on the default capsule, add a new one and attach it to the camera component as child. Viola, working like a charm, although FYI I’m using interfaces to interact with the objects spawned in the world (all blueprints actors).

Have you actually turned off “Hidden in game” on that capsule component yet? It will also inherent the look rotations of the camera.

I’m not entirely sure what you mean but yeah, Hidden in game is unticked.

If it isn’t a sphere then when it follows the rotation of the attach parent you will get the collision shape rotating with head tilt up and down. You will need to set Absolute Rotation on it so that it doesn’t follow the Roll/Pitch/Yaw of the parent camera.

In blueprint it is just a “SetAbsolute” node, in code it is a few properties on the component. You would want Absolute Rotation set to 1.

	/** If RelativeLocation should be considered relative to the world, rather than the parent */
	UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadWrite, ReplicatedUsing=OnRep_Transform, Category=Transform)
	uint32 bAbsoluteLocation:1;

	/** If RelativeRotation should be considered relative to the world, rather than the parent */
	UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadWrite, ReplicatedUsing=OnRep_Transform, Category=Transform)
	uint32 bAbsoluteRotation:1;

	/** If RelativeScale3D should be considered relative to the world, rather than the parent */
	UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadWrite, ReplicatedUsing=OnRep_Transform, Category=Transform)
	uint32 bAbsoluteScale:1;

This works great for things that you don’t want to follow a rotation axis with the camera (collision capsules) and is the simple built in fix.

I tried the same, but didn’t work for me. If I disable the collision of the standard capsule, the Character is falling through the floor.

Its because you are moving the character with a move command, it uses the collision of the root component to move things and doesn’t count sub components as colliders, so when you remove collision on the main capsule it doesn’t detect the floor anymore. If you directly set locations and sweep for obstacles yourself then it would work for you as a fast hackish method.

I’ve been looking into ways to have a simple solution for people for the past two days regarding root collision in VR (have a colliding body on the root follow the HMD in local space and can use default movement components) but haven’t achieved one I feel is good enough yet (threw out a working method that was too CPU intensive). I’m pretty sure at this point that I am going to have to re-write/override all of the movement implementation and physics transform updates in a shapecomponent to get a good implementation that “just works” for people.

This, the only difference I’ve got compared to @JackDaniel86’s setup is that my pawn is moved on tick with constant forward vector, in other words runs constantly just in a straight line, therefore it doesn’t fall through floor. You could, at least in theory play with add movement input scales and direction of the movement without the need for root collision although it might backfire at some point. Just a thought.

Root collision is also how other actors sweep against yours, to have everything fully correct a proper root collision is kind of necessary in this engine unless everything is going to be physics based interactions.

Could you share a screenshot of how you achieve this? I’m having difficulty making a capsule follow around my HMD. I’d like rotation to be be locked on the capsule, as well as movement in the Z axis, so the capsule simply moves around in X-Y with the headset (presumably, the location of the player).

It is in my VR plugin and is C++ so a SS wouldn’t help, if you want it in blueprint then on tick move it to the XY coordinate of the hmd plus the HMD relative height - half the capsule height. However unless the capsule is the root component then you aren’t going to get general player collision like you probably want.