Download

Is the camera-in-vehicle issue from UDK fixed in UE4?

With UDK there is a bug / lack of feature where if you place the camera in a vehicle (car, plane, etc), the camera does not take on the rotation of the vehicle in pitch and bank. The effect is that if you do a barrel roll for example, the camera won’t rotate and remains aligned with the horizon. Try the RiftCoaster demo and you will see what I mean.

Has this issue been fixed in UE4?

The camera/viewpoint system in UDK/UE4 can manipulate all three axes.
So no, the issue hasn’t been fixed since it was never broken :slight_smile:

RiftCoaster was designed for VR, so the the lack of mapped pitch & roll may be that way by design.
This is common practice for VR, thus far.

If you want to you can add the rotation of the vehicle to the camera.

Actually this isn’t true as Boone has said before that he simply wasn’t able to make UDK manipulate the camera at the time he made the demo. We had a lot of trouble with this in UDK, there’s a forum thread on it on the Oculus dev forums. (Which was actually started by him)

There are positives and negatives to each. Play with both and see which you like.

Isn’t true?
Which part?
I’m confused :stuck_out_tongue:

All of it, it was a big problem in the UDK, Cyberreality was working with us for a while to try to allow us to manipulate the camera. Also that Boone didn’t design the rollercoaster to turn the camera, he simply wasn’t able too.

You can definitely manipulate the camera/viewpoints pitch/roll in UDK, so I assume you must mean that it isn’t true in relation to the Rift.

I have no experience with this, as I had switched over to using the UE4 beta by this stage and did not investigate UDK + Rift integration any further.

So, to correct my answer:
The camera/viewpoint system in UE4 can manipulate all three axes in relation to the Rift or any other HMD.

Relation?
Don’t think I’m using the right wording still, but hopefully you get me :slight_smile:

Player axes + Rift axes = final camera axes.

It’s funny I was just experimenting with this exact setup. This does work in UE4, you can simply parent the Camera to your Plane, and set its Relative Rotation from the Device Rotation. That works great!
I also added support for zeroing out the rotation on one of the controller buttons.

VRCamera.JPG

Just to be clear, I have just now implemented the C++ code from the following link (https://wiki.unrealengine.com/Oculus_Rift_Separate_View) into my space-ship vehicle-based demo, and it works perfectly. Exactly as you would expect, the camera is free to look around the cockpit via the rift rotation, and that look “offset” is relative to the actual position of the ship, which is free to rotate in any direction, yaw, pitch, and roll. Works like a charm.

Good to hear.
Please let us know when it no longer works.
I expect that’ll be next update or at the release of the DK2.

Err, sorry, am I missing something? Why do you expect it to stop working?

At the time the wiki entry was made, there are no references to translation in the UE4 player controller or player camera manager.

Given that the DK2 supports translation, as well as rotation (6DOF vs 3DOF), I expect there to be changes to the Oculus plugin that will make the current implementation break or at the very least, be missing translation support.

Remember - VR is being developed as we speak.

Stuff breaks :slight_smile:

Ah okay, I see what you mean. Well maybe we’ll get lucky and it’ll only require changes and not a complete reimplementation.

I’m actually having a bit of a problem, I’m wondering if anyone might know something about this. Again, having implemented the “separate view” code in the wiki…

I’m finding that if I look far enough away from straight forward (so if I look behind me for example) then a lot of static meshes that I should be able to see are not being drawn. In fact, as I rotate the actual vehicle towards these objects I can watch as they start getting drawn when they enter what I assume is the camera’s view. It’s as though the code to let me look around with the Rift is not changing where the game “thinks” the view is, so it’s only drawing things within the stuck straight forward view, and not the actual separate Rift view.

Does anyone have thoughts on how to fix that? Is there a way to turn off the “not drawing outside of the normal view” thing? Just draw everything no matter where it is relative to the player?

Are you using the Blueprint version or the C++ version?

As far as I can tell with the C++ version, everything is covered, vis wise:

  1. PlayerController::GetPlayerViewPoint() calls PlayerCameraManager::GetCameraViewPoint().
  2. PlayerCameraManager::GetCameraViewPoint() returns POV.Rotation, which is set by PlayerCameraManager::UpdateViewTarget().
  3. PlayerCameraManager::UpdateViewTarget() calls PlayerCameraManager::UpdateViewTargetInternal().
  4. PlayerCameraManager::UpdateViewTargetInternal() calls AActor::CalcCamera().
  5. AActor::CalcCamera() calls UCameraComponent::GetCameraView().
  6. UCameraComponent::GetCameraView() calls YourCharacter::GetViewRotation().
  7. YourCharacter::GetViewRotation() calls YourPlayerController::GetViewRotation().

Though that is only if everything is setup in a certain way:

  1. PlayerCameraManager is not customised.
  2. PlayerCameraManager’s view target is your character.
  3. Your character has overridden GetViewRotation().
  4. You’ve included a CameraComponent.
  5. You’re CameraComponent has bUseControllerViewRotation set to true.

ugh

I could have missed something though, so please feel free to check and correct me if I have.
Gonna keep looking into it, as this is a big issue for those it affects :frowning:

You hit it on the head with the very last one - I had earlier set bUseControllerViewRotation to false in order to get the view rotation to follow that of the ship (that is, to address the original issue at the beginning of this thread). Turning it on appears to fix the rendering issue though reintroduces the previous issue, that the view doesn’t conform to the rotation of the ship. Your analysis in the last post was very helpful, though, and I’m thinking I know how to bring it all in line. Won’t get a chance to test it on the Rift until later but I’ll report back.

Wanted to update because I finally fixed the problem. Was much more simple than I had thought, spent a lot of time trying things that weren’t even close to working. The solution was to add the following somewhere in the PlayerController:

PlayerCameraManager->bFollowHmdOrientation = true;

Not entirely sure the details of why this works but it sounded right so I tried it, and it does!

They said in the twitch stream the other day that they’re going to add a very simple option to enable that feature, otherwise there’s an issue where the adjusted transform will lag 1 frame behind.

HMD rotation

Hi Shane,

I’m trying to create a camera that sits inside of a vehicle that is on rails for a VR experience. I’ve so far animated my model in 3ds Max and bought it into Unreal and attached my camera to a bone using Blueprint. So the problem I’m having is that when the vehicle turns it dosen’t update the HMD rotation - is the Blueprint above a fix for this issue? If so where do I plug the Blueprint nodes into? I’ve got a very similiar setup to the image at this top of this page

https://forums.unrealengine.com/showthread.php?18717-attach-camera-to-a-animated-mesh

Many thanks,

P

Bushy, you will want to create a Player Camera Manager BP, then set the “Follow HMD orientation” to True. Then go into your Player Controller and in the defaults, set the camera manager to the one you created. Let me know if that helps.