Resident Evil style...
 
Notifications
Clear all

Resident Evil style camera issues

5 Posts
2 Users
0 Likes
3,356 Views
BrokenBearGames
(@brokenbeargames)
Posts: 7
Active Member
Topic starter
 

Now that Tim is back (welcome back, sounds like a hell of a few years!)

I have a problem related to the camera vs input processing, I'm trying to make a resident evil style camera where on entering a new trigger a new camera is enabled, that works fine in that I just update the camera rig in the motioncontroller to the new camera and everything is now relative to the new camera, no problem, except then you end up just running right back towards that previous camera, so I tried queuing up updating the camera rig until no input is pressed, that works but has some other issues so what I really need to do is at the input level preserve the forward input while it's still being held down but update the other directional input on camera switch, then when no input is pressed set it all back to normal. That stuff is a bit of a black box can you give me some advice on how to best implement this with the mc input?
 
Here's a good example of what I'm looking to achieve: https://youtu.be/nLwZFeAauM8?t=4353

Several cameras with completely different orientations but the forward input is always preserved while it's held down, the other input (left/right) is updated as soon as the camera changes. 

Thanks!

 
Posted : 17/05/2021 5:27 pm
 Tim
(@timtryz)
Posts: 36
Member Admin
 

Hey @brokenbeargames

I hate to admit it, but I haven't played Resident Evil. So, the video was helpful.

If you can help me understand more, I might be able to point you in the right direction. Let's take these two images. The second one happens right after a view transition.

?raw=1

?raw=1

If the system is relative to the camera, in the first image I imagine I would press "S" to have the character run towards the camera. In the second image, I would imagine I would press "W" to have the character run away from the camera. From what you're saying, RE will keep the old camera view as the reference until no input is held. Then, it uses the new camera view as the reference.

I think that's what you're asking for. 

To start (and you may be doing this), I wouldn't change the "Camera Rig" property on the Motion Controller. Instead, I'd have the "fixed camera views" set in the scene and then swap the Camera Rig's position and rotation to the new "fixed camera view" position and rotation when you're ready.

I would put the logic in a new component on the Input Source MonoBehavior. This way you can check the input source for any key presses using the MovementX and MovementY properties. If they are both 0, do the swap (if there is one). Otherwise, use the current "fixed camera view" to update the current position and rotation of the MC's Camera Rig each frame.

I think that's the best way to preserve the rotation and direction.

 

If you'd rather do it at the "input level", you would actually want to create your own custom movement motion. The Unity Input Source handles input, but doesn't really take the camera angle into account. That's done in the movement motion where the input + camera + environment is used to determine final movement. You can see in the UnityInputSource.cs that it doesn't actually reference the camera anywhere.

What movement motion are you currently using?

 

 
Posted : 17/05/2021 9:24 pm
BrokenBearGames
(@brokenbeargames)
Posts: 7
Active Member
Topic starter
 

I'm using the BasicWalkRunPivot, I guess what I'm trying to explain quite complicated to communicate, I made some images to help:

 

https://imgur.com/a/OyTZ6zW

 
Posted : 18/05/2021 9:05 am
BrokenBearGames
(@brokenbeargames)
Posts: 7
Active Member
Topic starter
 

Hmm my previous post with the details says "Awaiting moderation"?

 
Posted : 18/05/2021 4:01 pm
 Tim
(@timtryz)
Posts: 36
Member Admin
 

@brokenbeargames Yeah I've been getting lots of spam. I need to research this forum tool to figure out how to let good people automatically post. Just another thing on my list... haha.

I believe I understand. BasicWalkRunPivot should be fine.

If you do what I posted above, you should be ok... even walking towards the camera.

 
Posted : 22/05/2021 8:41 am
Share: