#🎥┃cinemachine
1 messages · Page 13 of 1
Whats the best way to setup a camera that simply follows an object, and zooms in and out with mouse wheel, and middle mouse click drag rotates but still orbits that object. Exactly like OSRS if anybody plays that or mostly any 3rd person game? Any easy and simple way to do so?
If you are still having a problem, it sounds like your shaking is too strong at higher frequencies
As you increase your sample rate (i.e., your framerate), you'll start perceiving higher frequency signals more clearly
It's hard to say for sure what's wrong without an example though
i cant really show you an example without sending an 160fps viedo which idk if discord allows or if you can even view, but basically the shaking feels a bit too fast
at higher fps
To help visualize the problem, you could log the camera's position each frame and look at how quickly it's changing
or maybe use Debug.DrawLine to plot the path the camera is following
e.g. Debug.DrawLine(transform.position, lastFramePos, Color.red, 1f);
where lastFramePos is a field that you store your position in, of course
It does sound like you just have too much high-frequency shaking, though
i'll try this out next time i work on the camera, cus i dont really haev the project open at the minute. its a bit of a non issue honestly but it feels yucky to me lol
I often test my game at very high and low framerates to see if anything feels "weird"
low framerates will expose any "off-by-one-frame" errors
like a camera getting moved before its target moves
that was causing some really weird uncanny head poses for NPCs
i could tell they weren't quite looking at me
I hadn't actually considered how high framerates could cause problems like that
(beyond the obvious cases)
You're experiencing the Nyquist-Shannon sampling theorem here, I think 😉
if you aren't sampling quickly enough (i.e. your framerate is too low), you won't experience the full intensity of the shake
the camera simply can't go up and down fast enough
I don't think you can edit the built-in shake settings, but you can make a copy of one and then try adjusting it
(i've only done a little of that)
I'd like to switch cameras depending on which cameras can see the player, and if multiple cameras see the player, the one which is closest should be chosen.
I tried doing it with clearshot and trying to adjust the distance variables, but it doesn't seem to really work.
Is there some function in cinemachine I'm missing/misusing, or would behaviour like that need to be coded from scratch?
Good news. This exists: https://docs.unity3d.com/Packages/com.unity.cinemachine@3.1/manual/CinemachineClearShot.html
just noticed you said you tried it
what went wrong exactly? It should work fine
I'll record it and post in a sec
But basically, I have two cameras looking in a similar direction, but one of them is quite far away, and a second one is relatively close, and it doesn't seem to want to switch
Tested with both the player tag being ignored and with it not being ignored
also tried messing with increasing the priority on that closer camera, but that did not seem to help
What I'm trying to use this for, is basically a fixed camera system for "lower priority" areas, where a super exact trigger zone is not needed, so having the cameras be chosen just by "which one is the closest and in view" seems like a good choice for those places
sorta hard to tell from this video but the situation you're describing is precisely the situation ClearShot was designed for.
Maybe it thinks the closer camera is occluded for some reason?
Try setting Occlusion layers to None for a minute or something
and/or disabling all deoccluders etc
Alright, will give that a shot
and if it won't work, I'll send a vid without the fog so it's clearer
just noticed I messed up the video crop on the right, those are the current clearshot settings
how far is that camera from the player here? You have a near limit of 5
if it's clsoer than 5 it won't get boosted
tried lowering near limit and minimum distance to the lowest possible, no change so far
does your player have a collider
oh sorry actually it's the occlusions that need colliders.
Idk this is odd
Yea
As like, the camera does change, but that far-off camera seems to have the highest priority in most cases... somehow
here is a vid with how it looks from the start
The quality evaluation algorithm is quite naive. Cameras whose distance from the target is closer to Optimal Distance will be prioritized. If you always want the nearest camera to be prioritized, set the Optimal Distance to be at the near end of the range.
What is the best preferred and easiest for noob way to setup a camera that follows player object with zoom in and out from mouse wheel, and middle mouse click + drag orbits around the player? Simple OSRS style camera or really any top down 3rd person perspective camera? Thanks for any help I really appreciate it!
cinemachine or script?
both
If a script did all the following, zooming, and orbitting, what would I want cinemachine for? Just curious
Cinemachine would figure out how to pose the camera
Your script would tell Cinemachine roughly what you want
Sorry, what would pose mean in this context? I don't necessarily want a smart camera that avoids objects or sees through things. Cine gives greater control over FOV and things like that I believe, but yeah just curious because I mostly want a dumb camera.
The position and rotation of the camera
Your scripts would talk to the CinemachineCamera's position/rotation controls
Cinemachine also is used for transitioning between cameras and choosing which camera to show currently.
I don't think I will need any of that but it could be useful in the future so I guess I'll muddle through it now just in case. thanks!
I use Cinemachine for basically everything, even if I'm not planning to do any camera transitions!
As it turns out, I have made a really dumb error after fixing which everything worked as intended
I have disabled the cinemachine camera components on all the cameras inside a clearshot component, which I forgot about, as the cameras it switched to were some of the disabled ones
Enabling all the cameras inside the clearshot made them behave as indended
is there a way to drive the "time" parameter of a blend with code? i want an interactive blend between two cameras where the blend parameter is controlled by player input
Use CinemachineMixingCamera https://docs.unity3d.com/Packages/com.unity.cinemachine@3.1/manual/CinemachineMixingCamera.html
ahh perfect, thank you
Does cinemachine effect its target physics in any way ?
I used rigid body add force character control, and it didn't slide like it normally does
Could somebody please tell me how to disable the gizmo that seems to belong to the Cinemachine Rotation Composer? It's getting a bit distracting during playtesting.
I've tried disabling all game gizmos, but it stays visible. I've also tried disabling the one specific to the composer with the same result 🤔 If I deactivate the component, the gizmo goes away - but so does the functionality.
Found it! It's in the cinemachine main component and can be controlled with the dropdown entries:
Cinemachine does not interfere with the target in any way
oh, strange the character isn't sliding
the only thing it might do is change your camera position and rotation - so if your movement script depends on the camera position or rotation, then it might affect things.
but uh - yeah it's ultimately down to your movement code
<@&502884371011731486> ^^ scam
?ban 866948780962873375 bot scam
promanlul was banned.
hi
i need help i want to make a FPP camera but if i attach it to the head it start bobbing with the animation and does not rotate freely of the body
You wouldn't attach it to the head, it would be child of the capsule perhaps offset to height like (0.0f, 1.4f, 0.0f)
for FPP you want to avoid rotating on a pivot, in other words the camera rotates in its own space, not orbiting around at some XZ offset
currently the cinemachine camera is physicaly placed inside the player head and the model move in front of the camera durin the runnin or jump animation
what capsule can you explain a bit
so capsule of the gameobject
but will it move with the head like during jusp or when the character lean forward?
The main idea is, the camera is at some Y offset to the Player GameObject. Not the skeleton's head in particular, which as you can see can be "in front of" the capsule or offset in general X/Z/ rotation etc
Often the Player GameObject has its pivot point at the feet, so an FPP camera is placed at (0, 1.5f, 0) or something.
It will move together with the GameObject. But not together with the character's head part of armature lol that would be very offputting.
@sonic badge usually FPP cameras don't do anything like that, they use FOV to "zoom" or other things.
RN its like this
Having the camera within the Player GameObject can be tricky because it may rotate together with the GameObject.
i have to use FOSS as uni guideline for project so its made using the free asset of asset store
https://youtu.be/0CDvSM9kEpU?t=362
This video seems to cover a variety of topics. FixedUpdate vs Update timing / interpolation too.
At 6:03 he shows basic FPP camera settings. I think Cinemachine has it fully built in - no code even needed 🤔
ok will watch it but my prof want a implementation of the synopsis tomorrow and it 12:12AM here i dont know weather he will like it or not
ok i will watch it
if i send you a vid can you see and tell if it will suffice?
@sonic badge here are some other advanced videos if you really wanna learn the details 🗿
https://youtu.be/NsSk58un8E0
https://youtu.be/jSauntZrQro
https://youtu.be/YR6Q7dUz2uk
FPP is really simple ... Just use the Cinemachine built in stuff like in the other video 
I'm new to using Unity/using dollys. I'd like the 2nd knot to arch the opposite direction. I'm not super picky about how things flow but I really don't like it getting closer and then backing off. Is this possible with a spline? Do I have to use a different approach? If yes, can you recommend the approach I should use. Here is what I have currently :
Here is roughly what I'm looking for :
I believe I have a good understanding of why the jaggedness is happening but I wanted to check here with anyone that has experience with this issue. I am not sure if I'm on the right track with adding a slerp to ease the rotation.
Or possibly just seperate the camera and the movement entirely but I want to have the player's "Forward" position always align with the camera, is this a matter of the script or simply adjusting the rigidbody's attributes? I am going to be experimenting here in a few but wanted to ask just in case...
is this controlled by a mouse?
Yes
I feel like adding any layer of smoothing or interpolation gets in the way of the 1:1 feeling of controlling rotation with a mouse, no?
It also frequently leads to issues
If you're having "jagginess", it's usually an issue with how you configured things or your code
view direction and input directions are normalized and rigidbody physics are in fixedupdate... only thing I can think to do is adjust drag to make sure that the player isn't moving fast enough to get a heavy position change from rotation. I'm about to test that out but I don't think that will actually fix the issue. just prevent speed gain from the rotation..
Kind of a ridiculous question but using both input systems in this case wouldn't have anything to do with it right?
Kind of fixed it. I tried putting the orientation and inputdirection components into Fixed and Late update (not both just tried the two) with some linear damping and that seemed to help the issue somewhat.
This doesn't make a lot of sense to me. Wdym by a position change from rotation
If you're rotating in FixedUpdate you need to accumulate the mouse input in update and consume it in FixedUpdate
And then you need to be rotating in an interpolation friendly way
Can you show your code
Yes uno momento
public class ThirdPersonCam : MonoBehaviour
{
// Script for third person camera.
public Transform orientation;
public Transform player;
public Transform playerObj;
Vector3 viewDir;
Rigidbody rb;
public float rotationSpeed;
private float verticalMovement;
private float horizontalMovement;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
// Update is called once per frame
void Update()
{
GetInput();
Debug.DrawRay(player.position, viewDir, Color.red);
}
void LateUpdate()
{
viewDir = player.position - new Vector3(transform.position.x, player.position.y, transform.position.z);
// Sets orientation transform to view direction
orientation.forward = viewDir.normalized;
// sets player objects direction to orientation direction
Vector3 inputDir = orientation.forward * verticalMovement + orientation.right * horizontalMovement;
if (inputDir != Vector3.zero)
{
playerObj.forward = Vector3.Slerp(playerObj.forward, inputDir.normalized, Time.deltaTime * rotationSpeed);
}
}
private void GetInput()
{
verticalMovement = Input.GetAxisRaw("Vertical");
horizontalMovement = Input.GetAxisRaw("Horizontal");
}
}
public class PlayerController : MonoBehaviour
{
Rigidbody rb;
public float movementSpeed;
public float jumpHeight;
public Transform orientation;
public Transform player;
private float verticalInput;
private float horizontalInput;
Vector3 movementDir;
public float playerHeight;
bool isGrounded;
void Start()
{
rb = GetComponent<Rigidbody>();
rb.freezeRotation = true;
}
void Update()
{
isGrounded = Physics.Raycast(transform.position, Vector3.down, playerHeight * 0.5f + 0.2f);
if (Input.GetButtonDown("Jump") && isGrounded)
{
rb.AddForce(Vector3.up * jumpHeight, ForceMode.Impulse);
}
MyInput();
}
void FixedUpdate()
{
MovePlayer();
}
private void MyInput()
{
verticalInput = Input.GetAxis("Vertical");
horizontalInput = Input.GetAxis("Horizontal");
}
private void MovePlayer()
{
movementDir = orientation.forward * verticalInput + orientation.right * horizontalInput;
rb.AddForce(movementDir.normalized * movementSpeed, ForceMode.Force);
if (movementDir != Vector3.zero)
{
player.forward = Vector3.Slerp(player.forward, movementDir.normalized, Time.deltaTime * 5f);
}
}
}
I haven't cleaned up the code yet, sorry abt that
Ok so you're directly modifying your Rigidbody's Transform
That's a problem
It's going to break interpolation
You need to be only touching the Rigidbody
You're also changing it in both Late update and fixed
With the camera rotation you mean?
And changing the orientation in fixed and late with both scripts, I see what you mean
Oh that's even worse you have multiple scripts doing it too
So, the camera script by itself is okay, but what you're saying is by using the orientation gameobject to drive the direction in the playercontroller script is causing issues? Let me know if I'm misunderstanding what you're saying
Nvm I see what you're saying and understand it now, thank you.
@cursive spindle answering #💻┃code-beginner message in here:
Nothing has changed about how priority works. I think the idea is to nudge you to use things other than priority to control which camera goes live.
For example, in my game, I have a camera controller that decides which camera is supposed to be live, and all of the other virtual cameras are turned off
Priority can be a bit janky. If you increase a camera's priority to 10 so that it beats a camera with a priority of 5, it'll also start beating other cameras with priorities in the 6-9 range
Can anyone help me get the cinemachine input axis controller to work? The only thing working so far is the default map that came with it. I've tried setting the scroll wheel but it has zero effect and I can't figure out why. Additionally, when I set it to the scroll wheel, the input value field changes when i scroll, but the camera does not move
can someone help me out with a camera issue?
im using cinemachine to follow the player, but for some reason the camera's only rendering my background colour and nothing else, and theres no code interacting with the camera.
heres how it should look:
How did you configure the cinemachine camera?
and what position is your camera ending up having?
Make sure the z position of the camera is not the same as that of the player
it was a combo of that and for some reason my player had its own camera... tysm!!!
Hey all, using cinemachine for a third person spectator camera. When a player dies, the player's main camera swaps to an orbital third person camera positioned on another player. When I disable the first person camera and enable the spectator camera, there's this weird smooth pan between the two. How do I remove that?
Exactly what I was looking for, thanks!
I'm having issues that I need help with, my camera is moving on its own slightly
nvm i'm dumb, it was from the peril noise that I got from the unity first person start asset that
lol I was gonna suggest that
I had the same problem, it was that and the other time I had an xbox controller leaning on one of the sticks
i'm trying to have a dynamic camera for dialogue that puts the person talking around the center of the screen and the person listening near the left. one weird requirement i have is that it has to work at any angle, so if both the people are upside down or on a wall, the camera is at their average angle. i've been trying it with the target group follow extension, on regular ground the position and rotation arent as consistent as id like it (id like them to be in the exact same place every time if possible), and on tilted/upside down ground the rotation doesn't seem to work at all. i'm probably doing something completely wrong because i'm new to cinemachine, any advice?
Hello. I am having a problem with Cinemachine cameras. I currently have two Unity cameras (P1Cam and P2Cam) each with a Cinemachine Brain component, and two cameras (P1CamBrain and P2CamBrain) that are Cinemachine cameras with Cinemachine Virtual Camera components, Cinemachine Orbital Follow, and Cinemachine Input Axis Controller. My problem is that when I start the scene, I can freely move the Player 1's camera, but not the Player 2's. And when I restart the scene using scripts, I can now move the Player 2's camera and not the Player 1's. Player 1 uses an Xbox Controller with it's own controller scheme and Player 2 uses keyboard and mouse. Any help?
sounds like an input issue not a cinemachine issue
you'd have to show how you hooked everything up
This would be my Input Actions, and if I'm not mistaken, I've set the actions up correctly on my Cinemachine Input Axis Controller
these look like two completely different action maps. And I don't see anything about the control schemes
And you're using the PlayerInput component here too somehow? How is that set up?
im getting this after installing cinemachine
on unity 6.3
inspecting the code it seems like something for urp and im on hdrp so i just removed it 🤷♂️
So I'm trying to make third person cam and first person cam look the same direction when switching, but they don't match and I don't know what's the problem
third person cam uses cinemachine
first person uses a regular camera
I use this code to make them match, but third person goes back to where I left it, and first person just goes to default
FP_Cam_Transform.rotation = MainCamera_Transform.rotation; (on third person script when enabled)
MainCamera_Transform.rotation = FP_Cam_Transform.rotation; (on third person script when enabled)
have you checked if the internal smoothing state of the cinemachine camera was cleared or have you instructed it to clear all cached state that may cause glitches. There are various APIs on cinemachine cameras to override/set/match their state. Changes to the transform are generally overwritten immediately by cinemachine's internal logic.
Gonna take a look, thanks
Anyone got a good Idea on how I can add a trigger to switch to a different camera.
context, I'm doing a turn based RPG esc style, and there is an overworld, and an Arena world.
What I'm trying to do is that when the player collides with a rigid body that has the "Enemy" tag, it switches over to CombatCam, that way I don't have to make CombatCam a child of the the rigidbody that uses the "Enemy" tag.
i'm pretty new to programming in general so i've been wracking my brain over how to actually do this
Sounds like you have it all figured out already, what part are you confused about?
You need a script to make the MainCamera Keep same rotation as ur virtual camera in order to both keep facing the same area.
Just connecting the enemy up to the camera without placing the camera as a child, that way I can have multiple enemies linked to one camera
Lemme grab the video, it has the code inside
Main issue is, by taking the camera off as the child to enemy, it'll no longer work and I have idea why
Unless someone else has a different way of doing it
Generally with cinemachine you would just have as many CinemachineCameras you need pre-configured, and you either use priorities, or enable/disable them as needed to switch.
Also please - don't share code in a video
very hard to read that way
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
Apologies, only way I could, not home
So what you're say is, it might be better that each spawned enemy comes with a camera?
Since the idea is persona esc, you walk into an enemy, and it sends you to combat
If there are 3 enemies in the area, would it better for those 3 enemies to have their own camera directly in the same spot? Which would be the combat arena?
Like, what's seen in the video, the camera switches to a combat camera in a different version of the map, is it not gonna cost me resources to have 3 of those guys duplicated?
Cinemachine cameras are intended to be used liberally
they cost next to nothing when they're not active
Oh
So having each enemy copy have its own camera might not actually be that bad?
And I'm going through the struggle of having each enemy tied to one camera system for no real reason?
Which means I can just continue to work on the fundamental systems instead of getting stuck on one thing
I think I have that right?
xRotation keeps defaulting to 0, so the cam always looks forward
I followed this tutorial for first person cam
https://youtu.be/f473C43s8nE?si=MJda8A1lk9IjhInV
FIRST PERSON MOVEMENT in 10 MINUTES - Unity Tutorial
In this video I'm going to show you how to code full first person rigidbody movement. You can use this character controller as final movement for your game or build things like dashing, wallrunning or sliding on top of it.
If this tutorial has helped you in any way, I would really appreciate...
any idea why my cinemachine camera won't rotate? i'm using third person follow and hard look at. if i disable the third person follow, it'll rotate to point at the tracking target cause hard look at. it forces all rotations to be 0 with third person follow enabled
you'd have to show us your setup
the answer to "why is my cinemachine camera doing XXX" is usually "because that's how it's configured"
like a screen grab of the inspector for the cinemachine?
sure
trying to make a strategy game type camera where it orbits around an anchor
i could look up a guide on youtube but i'd rather try debugging it first
i'm using 6.3 if that helps
it broke in 3.1.4 to 3.1.5 i was copying my old project and tried updating old project's cinemachine
now to figure out if i can downgrade cinemachine or if i have to make do
so turns out it forces the camera to copy the tracking target's rotation
the third person follow is in position and overwrites the rotation component
If you hit this gear thing
you can set separate Follow + Look targets
witchcraft
lol ty i see it now
i had gone to use an orbital follow control which works similar but has it's own quirks
eh it still forces the camera to have the same rotation as the tracking target while third person follow is active not allowing hard look at to work. i'll keep to the orbital follow for now
Does the new Cinemachine decollider not work with concave mesh colliders? Mine seems to be working just fine with box colliders but not the walls in my room, which is just a ring of inward-facing quads. They're all on the same layer.
If your mesh collider is single sided it's likely there's nothing for the decollider Raycasts to hit
Where do the rays cast from? The walls are face the camera, so if the rays are cast from the camera's location then they should hit the walls.
I thought you said the walls were inward-facing?
Sorry, Maybe I described it wrong. The camera is in the center surrounded by quads that face the camera. I meant they are inward facing in that sense. The mesh collider is like an inside-out cylinder with the camera inside.
so what are you hoping the decollider will do for you?
You're trying to prevent the camera from leaving the box?
IIRC, the rays go from teh camera towards the thing the camera is looking at. Once the camera leaves the box it will be outside this inward-facing box so those raycasts wouldn't hit anything
Yes, exactly. It's just an interior scene and I don't want the camera to get outside of the room. If the camera were outside the room, then there would be nothing for the raycast to hit, but I would have assumed that the decollision component would prevent the camera from getting outside in the first place.
Actually, the more I work with Cinemachine 3.1.4, the more frustrating it is. I had the perfect camera set-up with just a few clicks in Cinemachine 2, but with 3.1.4 I just can't figure out how to get the behavior I want with all these weird settings whose names don't mean anything to me. I don't see other people complaining, so maybe it's just me.
trying to limit the camera, I made a boxcollider around the whole map that is pretty small. I had to assign "Ignore Raycast" layer. The view gets stuck inside the box but the Camera it self can still walk even futher outside of the map. How would I go around this?
hi, I've always used regular cameras and would want to use cinemachine cameras now especially to add a hiding system in my game with blending with a first person controller, I've watched some tutorials but very a few of them show what I'm looking for, most of the FP person controllers setup I have are simple Character Controller and a child camera, how could I achieve what I want simply?
There are many ways to do FP with Cinemachine. The simplest way for you would probably be to continue using your Character Controller script, almost exactly as-is. Just replace the Camera component with a CinemachineCamea component, and update the script to expect that rather than Camera. In the CinemachineCamera component, set all the procedural stuff to "none". That way, the CinemachineCamera is 100% controlled by your script (as before) but the difference is that now it's part of the Cinemachine ecosystem and can participate in blends etc. You can also add procedural noise and CinemachineExtensions if you want. You'll need to create a separate Camera GameObject, and add a CinemachineBrain component to it. See here for a general overview of how CM works: https://docs.unity3d.com/Packages/com.unity.cinemachine@3.1/manual/concept-essential-elements.html
thankk you soo much
I've just finished reading the most important parts of the documentation, but I didn't really find how to blend from one camera to another the best way via script, they just tell that you can set a cinemachine camera to live in the inspector and also with the priority values, if I want to make a hiding system, how should I do it? I'd like to blend from the fps cam to a non moving cinemachine camera with a function and then comeback to the fps cam with a function too
should I just change the priorities ? via script
You can manipulate the priorities by script, or activate/deactivate CinemachineCamera GameObjects. It's up to you how you want to organize things. If you have multiple active CM cameras, the one with the highest priority will take control. If there are multiple CM cameras with the same highest priority, then the most-recently-activated one will win.
Hi, my artist can't update CM to CM 3 in his machine, even tho i've updated it to CM 3 and pushed in the repo
Anyone know why the option to update to 3 doesn't show up?
It only says update to 2.105
Probably because artist is using Unity 2022.3. CM3 is still available, but you have to ask for it specifically: https://discussions.unity.com/t/how-do-i-install-a-specific-version-of-cinemachine/927513
If you've pushed it in the repo, then all users of the repo should get it automatically, no further action required. Did you forget to push the project's manifest?
I did push the manifest yes
This is interesting yes
I remember CM got updated to 3 bcoz i was updating some unity package which asks for dependencies update
Well in that case it makes no sense that your artist needs to manually upgrade - it should happen by itself. Did they pull the latest from your repo?
You and your artist should take a look at your Packages/Manifest.json files on your machines. Do they match? Are you sure VCS isn't saying they are out of sync?
So when I am testing in game with a cinemachine camera set up, the borders of the game window seem to be flashing white for some reason. Any idea why?
They're presumably the gizmos for the cinemachine camera
Hey everyone, running into a CM problem that I think may be quite common. Essentially I have set up a free look camera CM with the new 3.1.4 package and it works pretty well except for one thing. Since the rigidbody movement of my character is also depending on the camera forward vector and I rotate that character also depending on this camera transform vector I can see jittery movement when my character moves forward and rotates only with the camera rotation.
So I make my character move forward, I slightly rotate the camera to the right and I can see that it jitters and doesn't rotate smoothly.
I have tried a bunch of things:
- Setting interpolate in the character Rigidbody.
- Changing the update method on the CM brain.
- Decoupling the moment I access the camera transform vector in another update method and caching it for usage in the FixedUpdate method or LateUpdate.
- Tried setting the Position Damping of the CinemachineOrbitalFollow component all to zero.
Nothing works properly and I can't get smooth jitter-free rotation as you can see in the video.
DISCLAIMER: In the video it seems even more than what it is probably to lower frame rate, but it's still pretty evident.
Here is the code that handles the rotation. This is called from the WalkingState's Fixed Update (also tried LateUpdate):
if(_player.movementInput.magnitude > 0.001)
{
Vector3 cameraForward = _player.cameraForward;
Vector3 cameraRight = _player.cameraRight;
Vector3 direction = cameraForward * _player.movementInput.y + cameraRight * _player.movementInput.x;
direction.y = 0;
_lookRotation = Quaternion.LookRotation(direction);
}
_targetRotation = Quaternion.Slerp(_player.rb.rotation, _lookRotation, _player.rotationSpeed * Time.fixedDeltaTime);
_player.rb.MoveRotation(_targetRotation.normalized);
}```
Can you show:
- Where this
_player.movementInputcomes from? How is it populated, when is it populated?
Wait actually - all of this is kinda confusing for me
Where are these coming from:
Vector3 cameraForward = _player.cameraForward;
Vector3 cameraRight = _player.cameraRight;```
are those direction vectors?
Those are all coming from the PlayerController mother class of the StateMachine essentially. A container that handles state transition and setting up of variables.
The movementInput is generated from the PlayerInput component and invoking the HandleMoveInput method. In the Update I then get the cameraTransform.forward/right and assign them to the variables. Initially I was doing this step directly inside the rotation function, but then I decoupled it to test out wether it would fix something. I hope you can see properly from the screenshot, if not I'll paste the text
ok so you're actually just making the player rotation totally based on the camera rotation, not actually based on input
well, camera rotation mixed with the walking direction of the player
Yeah exactly
Was about to mention the mixing with the walking direction
Could this mixing be an issue? I wouldn't think so
I would try this:
Quaternion newRotation = Quaternion.RotateTowards(_player.rb.rotation, _lookRotation, _player.rotationSpeed * Time.fixedDeltaTime);
_player.rb.MoveRotation(newRotation);```
How is your camera rotation handled exactly? Through Cinemachine components?
Oh wait, also one major piece of the puzzle - does your player's Rigidbody have interpolation enabled?
Now yes
It didn't improve much
And you're rotating through cinemachine?
With this code it doesn't rotate at all actually. I simply substituted the Slerp and now nothing happens, I'll check documentation of how that works
Rotating the camera or the player?
can you show the full resulting code you used?
In any case I am rotating the camera only using cinemachine components, an extra thing I added was a customInputHandler script because otherwise I would have too different sensibilities for mouse rotation and controller rotation:
Here's the resulting code causing no rotation at all
Oh actually I bet it's probably causing rotation just VERY SLOW
Can you try increasing _player.rotationSpeed?
like, a lot 😛
SOmething like 50 or 100 would be a good value @twilit pier
Yeah ahahah literally just fixed it
So yes, increasing it to 1000 did the trick
But the jittery when moving forward and changing direction with the camera is still there
Ok I have another suggestion for you:
- Move the rotation code to LateUpdate instead of FixedUpdate
- Change the code to:
Quaternion newRotation = Quaternion.RotateTowards(_player.rb.rotation, _lookRotation, _player.rotationSpeed * Time.deltaTime);
_player.rb.rotation = newRotation;```
Done and it made the problem worse as now it's jittering even when walking normally in any direction. Tried changing the update methods of the CM brain, but nothing. Removing interpolate in the rb helps a bit (still doesn't fix the original problem), but I know it is not optimal in this case and I think I will need it in the future in any case
I really can't wrap my head around this issue
I'll be honest in your video above I didn't actually see any "jittering"
so maybe what you're describing as jittering is something else
It's not easy to see from the video because of the low frame rates I think, but it's quite noticeable in the game mode at very high frame rates. Not sure how to showcase it properly
maybe a silly question but have you constrained the rotation on your Rigidbody?
that's good
@twilit pier @royal tartan https://discussions.unity.com/t/rigidbody-cinemachine-jitters-with-without-interpolate/1594117/2
how do I make my camera only track my player on the x axis?
Two simple-ish approaches:
- Use a huge y axis deadzone
- Write a simple script to move an empty object to the player's x position and a fixed y position in LateUpdate, and have your cinemachine camera follow that empty object instead of the player itself
2 questions for people who make third person cameras with cinemachine:
- How do you make a perfectly spherical camera orbit (with some logical vertical clamps)
- What do you personally like in your third person cameras and how do you achieve that (don't need to be super detailed, just basic ideas)
This doesn't look Cinemachine related. More like a #💻┃code-beginner or #🖱️┃input-system question
(they told you to go to #💻┃code-beginner not here)
What happened to simple follow with world up option? Trying to override the world up in brain to players up and have this freelook rotate with it but the lock to world up rotates the camera to follow the player which is wrong
For a spherical gravity controller
is there a reason that i cant see that in the spherical camera demo scene for cinemachine, the lock to target mode doesnt auto rotate the camera to the players fwd?
Anyone here think they could help me with changing the Horizontal Axis of a freelook camera in a script?
specifically the Horizontal Axis Valuei nt he Cinemachine Orbital Follower
generally you'll want to share details of what you tried and what's going wrong with it
I don't know what to call it
what do I call to directly change the Horizontal Axis Value
ok I put public InputAxies HorizontalAxis in, but when I get an error when I do HorizontalAxis = 90;
Yeah it's an InputAxis not an int
also you probably don't want or need a field for this.
why? Then how will it know I want to change the Horizontal Axis?
Then what can I put into an InputAxis?
How would making a random InputAxis field tell it anything
thats what the link told me to do
you need to change the value on your CinemachineOrbitalFollower component
it is absolutely not
the documentation is simply describing the field that exists on CinemachineOrbitalFollower
it's not telling you what code to write
documentation describes the existing code
An InputAxis
here, you probably need an example
ok then, forget the InputAxis what do I need to put in to change the value on a CinemachineorbitalFollower Horizontal Axis?
Example:```cs
// Assign this to your orbital folloer component in the inspector
[SerializeField] CinemachineOrbitalFollow orbitalFollow;
void SetAxisAngle(float angle) {
InputAxis axisData = orbitalFollow.HorizontalAxis;
axisData.Value = angle;
orbitalFollow.HorizontalAxis = axisData;
}```
So I put this into a script?
Where else would code go?
Well I put it in and I'm getting errors so I'm checking
what errors are you getting?
Says the namespace CinemachineOrbitalFollower could not be found
it's not a namespace
That's definitely not the whole message
show the code you tried and show the full error message
Ok read the full message in the future
But yeah it's not CinemachineOrbitalFollower
it's CinemachineOrbitalFollow
I see
Also you didn't quite copy the code structure correctly
anyway this code isn't going to do anything on its own, you'd need to actually call this function with whatever value you want to actually set to it
got it thank you
Ok, now I'm having trouble figuring out how to access the Input Value in Cinemachine Input Access Controller
I have a Spline, I want the camera that follows the spline - to have the rotation the same as the knot rotation.
is that possible?
the camera seems to always require a lookat target.
the spline dolly look at targets requires lookat targets
Hi i'm having a weird problem. The transform component of my camera is like this and a bunch of errors is freezing my editor
After a while, editor crashes
Posting here bcoz it may have something to do with cinemachine
Nvm, reset editor layout and that fixes it i guess
Btw another thing. My virtual camera's rotation is something (30,90,0)
But my camera CM brain object's rotation has different value
It's not a big problem if they're actually poiting to the same and same up direction
But sometimes the difference ends up having random small values
Like these
And i see it starts changing bcoz i guess the Deoccluder feature. It adjusts when it hits some collider otw
But when the camera completely moves out of the occluder, it doesn't return to the original rotation
The tilting adds up and eventually my camera's not in the same rotation (among others, the Y rotation) anymore
Do either of these objects have a parent object?
my cinemachine deoccluder not working
Yes
I also notice my deoccluding behaviour also involves a "steering" kinda tilt. Like, Z axis rotation (camera view wise) that doesn't always return to 0
And only happens when the deoccluding. When there's no occlusion, this Z tilt doesn't happen
that's why the numbers are different. They are local values
generally in cinemachine it doesn't make a lot of sense for either cinemachine cameras or the main camera to be children of anything
I mean it used to work just fine. Forgot when but definitely before i upgraded to CM 3
Can this be turned off?
I've confirmed that even when the VC and the camera (with CM brain) has no parent, this behaviour still happens
Ya actually there is no Z rotation. Just X and Y
Why can't the deoccluder just zooms in until it gets out of the occluding object? And not do any rotation at all?
My deoccluder's strategy is already "Pull Camera Forward"
Dampinig when occluded to 0 do help prevent this tilting, but still not fully gone
And also, even with these 2 having no parent, the rotation of the main camera still end up flipping around (Z -180 etc)
I guess i gotta revert back to CM 2
Been trying to solve this for a day and asked previously but couldn’t solve.
Anyone know what replacement for this is in cinemachine 3?
Have the brain camera overriding world up, but in the rotation composer, I don’t want the camera auto locking to the players fwd direction all the time
Or anyway to disable the yaw rotation in lock to target?
also in this cinemachine demo they have the orbital binding mode set to lock to target yet the camera doesnt rotate towards the players forward which the docs say is supposed to happen
Hi! I'm trying to figure out how to detect mousemovement using the InputValue in Look Orbix X but I'm having trouble figuring out how to check that variable in a script
I've tried this but I'm getting errors
Hi just making sure. I had CM 2, updated to CM 3 but having issues
I'm on unity 2022.3.55
I only somehow updated to CM 3 bcoz a dependency of a unity asset requires (recommends?) to update to CM 3
Now that i see in the package manager, CM 2 is still the "Recommended/Release" and there's no label on CM 3
When i downgraded, CM 3 no longer appears as an option in the package manager
So my question is basically, is CM 3 still experimental? Or it's not recommended for unity 2022?
Can anyone confirm that CM 2 is still much more stable and reliable in general, specifically for unity 2022 or in general?
CM3 is the most stable and reliable version, for 2022.3 and up. Officially it's only for Unity6 and up (which is why you don't see it in package manager and have to intentionally install it by name and version, but it does work for 2022.3). Some behaviour might be a little different when compared to CM2, but that doesn't mean it's less stable.
The deoccluder is not behaving properly. As in, i have to consider it broken even
Related thread https://community.gamedev.tv/t/cinemachinedeoccluder-behaviour/253065/7
Altho i don't understand his last sentence in the last paragraph
One caveat, however, is that it appears that the DeOccluder doesn’t memorize where it was when you encountered the occlusion… this means that for something like a freelook camera, the return position may not be where it was when you started. It should return to a calculated position based on the positioning component’s calculations. (This was actually true of CM2’s CinemachineCollider as well)
Does he mean the original position also gets forgotten in CM 2 ? Or it works properly in CM 2?
I just confirmed, i downgraded to CM 2 and did all the changes back, and this deoccluder (it's called CinemachineCollider) behaves properly. No accumulating tilt on rot X/Y, and no "steering left/right tilt" behavior either (which i think is from the DampingWhenOccluded. But i turned this to 0 and in CM 3 it still damps, while in CM 2 it's properly 100% snapping and not accumulating tilt)
Anyone?
I think you shouldn't touch the input axis controller.
It auto feeds the values to the other Cinemachine components. (in the manual they are called axis drivers)
so you are probably looking for the values from the CinemachineCamera or it's components
Can someone explain to me why the Material Converter, ALSO converts Cinemachine across all scenes suddenly with no warnings?
What do you mean by "converts" cinemachine?
I ran the material converter and suddenly my console was spewing out that something found a cinemachine game object without a spline or adding a dollycart spline to a game object that had a script on it that referenced it and such (see screenshot). It was absolutely bonkers additions to and since I have many cinemachine components in my app, it made a mess of it all. I never asked for it and it never even warned me that cinemachine updates were part of the material conversation process. Perhaps it was a bug that caused the converter to trigger a reimport of cinemachine components? No idea but I had to go to a backup and lost 90 mins in the process.
Just prior to this I did a Library reimport and none of these issues came up and they are not even issues to worry about. Was a very odd experience.
Judging from how many unrelated errors you have it's likely not anything to do with Cinemachine exactly, and maybe not with the material converter directly either
Rather the whole asset importer process crashed and broke a bunch of things
Some crashes with the error code 10054 you have there were fixed in newer patches of 6000.0. in case you're using an old one
hello,how could I make a lookat transform system with cinemachine camera, the virtual camera should rotate and look at a specified transform during a specified time and then rotate back to its original rotation?
Make another CM camera that's set to track the specified transform, and swap between them by disabling/enabling
ohh okay that's what I thought to do but that wouldn't look natural tho would it? I want it to look like the player just wants to turn you know and not go from one camera to another
https://docs.unity3d.com/Packages/com.unity.cinemachine@3.1/manual/ControllingAndCustomizingBlends.html
It is designed to help with that
And by default it does a smooth blend to another CM cam when the active one is disabled
okayyy thank you so much man
sorry to disturb you again, but I just did it, made another virtual camera with higher priority, set it unactive in the scene, once I want this cam to lookat the transform, I set the camera active for a float amount of time, I disable the PlayerMovement script too and then I simply set it unactive back but this doesn't work as expected, the rotation never does so,I just added the transform to the lookat in the component btw
You can test CM cameras separately and I recommend doing so before testing the blend
Both of them as the sole enabled CM camera should move and rotate as you expect
Specifying a target is not alone enough, at least not in CM3, you also need a CM component to use the target for a particular kind of rotation
by CM, you mean Cinemachine Camera? if yes, I already have it as I'm using cinemachine virtual cameras
CM 3 calls them Cinemachine Cameras or CM cameras
CM 2.9 calls them virtual cameras
They are the same thing but configured a bit differently
yes and that's what I'm using, I just put a lookat transform in the component field lookat and it doesn't work
you said I'd need a CM component too and I have one..
Which one? I listed two possible CM versions
cm3
Yes, like I said it's not enough to specify a look at target because you don't additionally have a component on the CM camera to specify what to do with the look at target, as there are many ways to "look at" something
When you set a Rotation Control or add an extension it will add a CM component
You probably want a Rotation Composer or Hard Look At as the Rotation Control
CM components are different from the CM camera component, I don't blame you for being confused
adding just one of these extensions would make this work?
You may need to tweak the settings for it to work as you hope, but likely yes
when you said CM component I thought you meant the CM camera component lol which was also why I was confused
I recommend you read the first few chapters of the documentation so it will make sense
https://docs.unity3d.com/Packages/com.unity.cinemachine@3.1/manual/get-started.html
CM is meant to be used in a particular way, and luckily the docs are brief and well written
You can also import sample scenes from the package manager for CM, which will show exactly what kind of camera actions can be achieved and how
okayy thank you I'll do it right now, I've already read it a month ago or something like this but it was more to learn Cinemachine cameras themselves for First person etc not specifically for something
The introductory part is the most important one
How they relate to real cameras, how the brain manages the virtual cameras and how the CM components control the motion of the virtual cameras
for real lol
How do I make it so that the cinemachine free look camera moves based on a leftmousebutton being held down?
like I only want the camera to move if the left mouse button is pressed and the mouse moves
How do I create a camera that follows the player only when they're towards the edge of the screen? I saw someone doing this with "dead zones" in a tutorial just now, but it looks like they were using an old version of Cinemachine that has some differences. the dead zone part on my camera doesn't seem to do the same thing
Dead zones sounds correct. Perhaps share the details of your setup
nvm I figured it out, I had picked the wrong camera and the dead zone variable in that one was affecting something else I guess
The server's not a place to solicit work
I recently updated from Unity 6 to Unity 6.3 and I noticed the Deoccluder stopped working, I opened up the script and noticed the enitire #if CINEMACHINE_PHYSICS section is now grayed out. The project sample works, but my scene implementation doesn't work... I'm missing something post-upgrade but can't figure it out

Check your project's physics settings
is PhysX enabled?
So after some testing this morning, there's some kind of bug in CM 3.1.5 where the Deoccluder component is ignored with the CM Third Person Follow component and requires you to check "Use Follow Target". However, if you check that, you get a really poor occluding result with some clipping and poor quality for handling camera distance, likely due to new damping code.
After falling back to 3.1.2 (which is what I was using before the upgrade to 6.3LTS), the issue resolved itself.
So I guess if anyone is trying to use the Deoccluder with the Third Person Follow is going to run into this as well. You can use the "avoid obstacles" in the TPF component as well, but it's not as graceful as the Deoccluder.
I wonder if I'm the reason the "Use Follow Target" option was added in the first place (i asked about it in the Cinemachine forums after editing the package to add that)
so uh, i guess this is my fault 😉
Probably should have tagged Gregory but don't want to bother the dude... I bet he's the only dev working on CM as it is. 😓
im following a cinemachine tutorial and the tutorial author is able to visually see the geometry of the orbital follow, whereas I have the same setting and am achieving the same functionality but do not see the same thing in my scene preview. Screenshots attached. Is there some setting or something I'm missing?
Check your scene view gizmo visiblity button
hmm thanks, I don't see that. Am I overlooking it?
The arrow points to the one you need
Circled ones are useful to have
thank you!!
Guys I am just starting to use Unity and I know this is probably the most noob question but how to I get into the scene view? I don't really know what I did but I can't scale and rotate around the 3d scene like I was able to do in the tutorials. I'm guessing I'm in 'Game View' or something. I can't click the cube I created to make adjustments, and I can't change my camera view.
Window -> General -> Scene
Or right click on the title of any tab and Add Tab -> Scene
Thank you 🙏🏻
Why does it look so choppy when the cinemachine tracks an object
you've configured something incorrectly.
And/or your object's movement is actually choppy
It wasnt choppy until I did the cinemachine thing.
It maybe was choppy in a different way. But I really can't help you any more than this unless you provide details about how everything is set up
THe most common issue is Rigidbody motion without a proper interpolation setup and/or code breaking the interp
ohh ok
can we change clipping planes in cinemachine camera. i am unable. the value reverts back to default on changing.
Yes, you should be able to
Bro i try sliding it doesn't change. I enter a value and it reverts to default
Why is this happening?
Where are you changing it exactly, and to what value
Also i am getting this weird wall clipping issue i talked about in #💻┃unity-talk
near and far clipping panes
You have to change it in your cinemachine camera
in cinemachine brain? or cinemachine camera?
Cinemachine camera
i cant find it
oh yeah its under lens
damn should have looked for it before
thanks though my issue is resolved now
it was so obvious
I guess less obvious now that cinemachine cameras are no longer called "virtual cameras"
So no confusion about whether CM cam refers to the real camera, the brain or a virtual camera
i have another issue but its not related to cinemachine. my unity is crashing a lot. i am using hdrp and my ram is 16 gb. it crashes even when i open one tab of youtube in side.
so i cant follow tutorials properly
the fact that its not crashing with discord is such a life saver
i have a 3050 laptop. is it normal for this hardware?
Crash logs may reveal something
I had 16 GB ram and easily had multiple unity projects open, HDRP or otherwise, while using other programs at the same time
wth u mean by multiple
i barely can run a single
😭
i thought it was a ram issue
also i have a laptop if that makes any difference
AND IT CRASHED AGAIN LMAO!
I wouldn't blame ram for it primarily
Could be due to anything
Maybe even something with your particular editor version or project, rather than unity itself or your hardware
im using this configuration for an orbital camera which only moves if i click and drag the screen, but i want the camera to permanently move with the mouse, i was told to rebind to mouse delta but that doesent seem to work or register
hello, i have a problem in cinemachine where is my cinemachine seems like its running on 60 fps even though i have 400 fps what maybe the problem
hi guys i still have the same problem its very choppy
Cinemachine doesn't have its own FPS
Unless you have set it to "fixed update"
On the other hand if your tracked objects are moving in the lower FPS fixed update, such as as uninterpolated rigidbodies, they appear choppy relative to CM camera's smooth movement
So, make sure your CM camera is in smart update
Make sure your rigidbodies have interpolation on
Make sure your code isn't overwriting the position of any rigidbodies, or moving objects in fixed update
it maybe not about fps, but the camera doesnt move smoothly it looks choppy
Advice applies nonetheless
i dont have anything i just added the camera made it target an object only that
If you don't have "anything", what's moving?
i mean the camera rotation
So, everything is totally still except for the moving camera?
What is moving the camera
i mean the camera display is choppy i have it on a stille gameobject its rotation is choppy thats what i mean nothing moving in scene
i had it late its laggy in smart its also same
changed the blend still same issue
But there is no blending happening is there
If you want to troubleshoot the choppiness of motion, you have to look at what is doing that motion
And potentially verify how the issue is manifesting
The editor can jitter for reasons unrelated to what's happening in your project
Compare to movement of something that verifiably is moving in Update
I am making headbobbing using different noise profiles. I was going to use multiple camera's so it transitions between them smoothly but I want to know if I can just use one camera and is it possible to smoothly transition between the noise profiles.
If you want smooth blends between them you'll want multiple cameras
I did try that but switching camera's was smooth but the noise profiles were not smooth at all as they are all moving differently.
hello , i'm trying to use cinemachine dolly track and i'm trying to switch the speed but i can't seem to be able to call it with public reference.
does anyone know where i could find information about that cause i can't seem to find it.
Is there a way to force Cinemachine to only pan horizontally? I have a series of objects placed side by side horizontally and a menu from which I can select them. Once a different object is selected, the camera should pan horizontally only.
I can achieve this by using a "Rotate with follow target" as the rotation composer, but then I lose any ability to rotate the camera.
If the objects are in a row horizontally, what kind of movement are you seeing then, and how are you swapping the camera when "selecting" a gameobject
I think I fixed it, sorry it was my fault 😄 I had implemented a lookat function that also calculated a viewing angle and that was causing it
can the fixed speed on the cinemachine spline cart be changed in script?
nvm found how
@artemka09470 muted
Reason: Sending too many attachments.
Duration: 29 minutes and 41 seconds
This is an English speaking community.
I have been stuck on this for a while now, I made this head bob effect and I can't make it relative to the direction I am looking at. Any ideas how I can fix this?
Script: https://paste.ofcode.org/LKta7KcJkKcS6xyx6zAnEY
it looks like whatever object your camera is a child of is not actually rotating
you're probably doing the rotation through the camera only or something
the parent is rotating.
I mean when you rotate left and right
the Player object is not rotating
So the player object needs to rotate with the camera? i.e. when rotating left and right?
the camera shouldn't rotate on the y axis
it will rotate automatically when its parent does
Oh shit your right I was a bit confused at the beginning lol. When I rotate my player object the headbob is rotating properly now.
Hey, is there a way to set the Tracking Target on the cinemachinecamera through a script?
Yes, whatever you cinemachine camera is called in your script for example vCam you would do vCam.follow = newEnemy; newEnemy would be a variable.
thanks
how do you make fps camera in the unity 6 like chinemachine camera should i use
Idk, if somebody already answered, but how in 2D make camera move in player momentum direction? Using follow and make camera drag is bad approach
No difference from previous versions
i am makinga fps camera how do i make the camera look around in first person
in presiouv version there used to be a script for the main camera to do so but its not there anymore
Anyone got any good links to how cinemachine 3 operates? I'm getting major whiplash going to the new version. Already looking at the docs.
the new version look very different and even i can't find any explation video on it
Gotcha. I switched to looking at one of the samples they have on it. Making slight progress XD
wait does any of them contain any fps camera to
The one I'm looking at is third person
check for first person to
I don't recall any fps ones though
Not explicitly named, but maybe there's one that can be adapted to an fps
which one
I'll take a look
okay
Yeah, nothing immediately screaming "fps", but here's the samples for 3d
the free look ones might work but i can't be sure
Granted, I think fps games wouldn't need cinemachine? Usually when I do an fps I just make the camera a child of the player and control its rotation directly
problem is when you try something complex with the camera like ability to switch camera and stuff like that
Ah, yeah that make sense
plus i don't think it will be that good for multiplayer
Here's the doc page I used to download these btw:
https://docs.unity3d.com/Packages/com.unity.cinemachine@3.1//manual/samples-import.html
no worries i found one in the unity projects to if i find anything i will tell you
Gotcha, appreciate it
i actually didn't find any so i decided to make my own version
this is how i did it. its self closed so can be turned into a prefab the chinemachine, the camera refrence target and everything is in a single gameobject and refrence eachother so as long as the chinemachine exists in the chidren it will get the camera on its own without any problem
turns out they are also using there own custom script for first person. there is chinemachine camera build for first person at all
You write a script
First person look scripts are very common and simple
Sorry for the extremely late reply. Yeah, looks like some custom work is needed for both 3rd and 1st person. For 3rd, I'm thinking of some ideas because the way it was done in one of the samples didn't vibe with me. It does give a good reference point on what needs to be addressed though.
maybe but i am making a mutiplaer game there are going to multiple things and unique thngs in the game realted to camera common first person script would fail for those hard code loghics
maybe for thrid person attach the game to a player camera point at a distance and then rotate the player camera target independently of the player and the player movement script can calculate the forward vector using the player camera target
Im building for android and i want the binding mode of my camera to be lock to target, but when i try and build, the camera behaves as it is on lock to target on assign, which is the complete opposite of the behaviour im looking for, why is that?
Can android even run for this way of handling my camera?
It works fine when i play in the editor btw...
Have you tried a desktop build? Aside from display size differences I don't think code function like this should differ by platform in any way really
no i havent, but i found the issue, the angular damping mode should be set on quaternion instead of euler, it works now. Thanks a lot tho!
Am I misunderstanding how cinemachine volume settings work? I have multiple cinemachine cameras with different postptocessing profiles used in their volume settings components. I can switch between them and everything works great. I also use a screen space overlay UI which is getting distorted by the various cameras. I don't want that. So I've setup a secondary ui camera, put my ui on a layer set the main camera to ignore ui, the secondary to render only ui and added stacking. The stacking works correctly and my secondary camera renders the ui, but it's still affected by the base camera's post processing! Is this expected? is there a way around it?
(ok, so turning off postprocessing on the ui camera is partially what I want, but ideally I'd like seperate postprocessing sets for both cameras?)
Every time i try to assign a cinemachine brain component to my main camera, it stops my camera zoom code from working. I need cinemachine attatched to the main camera because i'm trying to make it so that the camera can't go out of bounds.
Here is the code it breaks.
using System.Collections.Generic;
using System.Collections;
using UnityEngine;
public class CameraZOOM : MonoBehaviour
{
private Camera _camera;
private float zoomtarget;
[SerializeField]
private float multiplier = 2f, minzoom = 1f, maxzoom = 12f, smoothtime = .1f;
private float velocity = 0f;
void Start()
{
_camera = GetComponent<Camera>();
zoomtarget = _camera.orthographicSize;
}
void Update()
{
zoomtarget -= Input.GetAxisRaw("Mouse ScrollWheel") * multiplier;
zoomtarget = Mathf.Clamp(zoomtarget, minzoom, maxzoom);
_camera.orthographicSize = Mathf.SmoothDamp(_camera.orthographicSize, zoomtarget, ref velocity, smoothtime);
}
}
If you're using cinemachine you have to control the camera through cinemachine
you basically need to do what you're doing now except through the CInemachineCamera instead of the regular camera
Is a first person view achievable with cinemachine 3?
Nvm. Figured how to do that
update: I rewrote my entire script and completely deleted cinemachine from my game.
it now works as i want it to. 🙂
Question about zooming: I'm causing my camera to zoom in out by manipulating the CameraDistance value of the position composer. However, if my camera is "homing in" on another target (this is kind of an RTS-like camera) and at the same time I zoom, the camera will zig-zag. It will zoom in in the current forward direction and then move laterally.
What would be the best way to make it zoom along the direction it is heading?
What happens if you zoom by adjusting the FOV instead of the distance?
This is a quick video of what I mean
Well I'm not sure why your zoom is happening in fits and starts like that
that could be an issue with your code? Are you changing the distance over time manually?
that's just me pressing the mousewheel different times 🙂
tbh I would probably disable manual zooming (and do an automatic zoom) when selecting a planet like that
and how can you do that?
Right now I was zooming like this:
ActiveControl.Distance = Mathf.SmoothDamp(ActiveControl.Distance, targetCameraZoom, ref cameraZoomDampVelocity, CameraSettings.ZoomSmoothTime, 100, Time.deltaTime);
activecontro.distance is an interface to the position composer
just disable whatever code you have doing that during the transition^
like if (!currentlyTransitioningToNewTarget) DoZoomLogic();
That's a solution I guess, but people might still try to press the mousewheel and then it won't work.
Is that an issue?
The point was that the zoom makes the camera transition look bad
Is it that essential that zooming works during the transition?
again I would likely do an automatic zoom as part of this transition
to some extent, right now if you zoom in enough the system goes to a different "mode", where the planet is seen "in scale" with the correct proportion (so it would hide very far away planets and show moons, etc.)
Since the "homing in" part takes at least a second I thought people would attempt to zoom in anyway, so I wanted to make it more pleasant.
I added shoulder switching to my project with 2 Third Person Follow cameras. Should I delete one and just make the shoulder switching function move the Camera Side from 1 to 0?
I kinda got hit with this realization now but do I HAVE to do it? Will there be issues if I just keep the 1 camera on each shoulder method?
Damn son 😔
the only issue with the two cameras thing is if you decide to make changes to the camera you need to do it twice.
This can be largely mitigated by using prefabs
Oh ok
I won't have to recode
Also can you tell me why the Third Person sample scene is using this setup?
Isn't there an extension for the Third Person Follow camera that does Aiming?
no idea
Ok then
My main question was about the shoulder switching and that has been answered
Thanks
Yeah with this setup I'm pretty much ending with 4 cameras per player (2 for Third Person Shoulders, 2 for Aiming)
Will this have any impact to performance? I'm new to this
And again, it's PER player, so in the end it's gonna be like 40 cameras
Hello, please help! How do I make the third-person camera rotate around the character instead of around its axis? I want to get the effect where the character goes one way and the camera can look the other way. I'm using Unity 6.3.
anyone getting these errors when upgrading from 2.x to 3.x?
i cant even access any of the api's in the script
Try deleting your library folder
im watching a tutorial, does anyone know where these axis controls are now in the latest version of cinemachine? first pic is from the tutorial im watching
Don't waste your time with outdated tutorials. Check out these new ones: https://discussions.unity.com/t/new-5-part-cinemachine-3-1-youtube-tutorial-series-available/1685256
does it go over how to make a third person camera with it?
yes, one of the videos is specifically dedicated to that
I recommend watching them all (you can do it at 2X speed to save time). Then you will have a good sense of how Cinemachine works and will be able to reason about it in the future
do you have a video recommondation for a player controller to go with it?
Not specifically, but the controllers that ship with the Cinemachine samples are a good starting point. See if one of the samples has the sort of camera and controller behaviour you want, and copy them.
Thanks but I just downgraded to 3.1.4
how do drive Cinemachine cameras with custom input now? I've looked at the InputAxisController docs and samples but they don't really appear to work.
which components did you pair it with
I was trying to use this sample https://github.com/Unity-Technologies/com.unity.cinemachine/blob/main/com.unity.cinemachine/Samples~/Input System Samples/Split Screen Multiplayer/CustomInputHandler.cs
When I add it to my camera the property panel shows a bunch of "No GUI implemented" errors
Stupid question but how did you install the sample
and how did you install cinemachine
I installed the package and sample using the Window->Package Management->Package Manager
Even in the sample scene it looks like this
That's odd - this is what I see
having just installed the cinemachine package
dumb question but do you have the input system package installed?
which version? I'm using 3.1.2
I'll try the newest version of the package
nope same problem, I'm on Unity 6000.3.5f2 and 3.1.5 of Cinemachine
I'll try a fresh project
works in a fresh project so it has to be some package interferring
Is it possible to set the horizontal/vertical axis on the CinemachineOrbitalFollow without using an CinemachineInputAxisController?
sure you can just set the values yourself in code
can anyone help me with the pixel perfect camera, i want to increase what the player can be see while keeping pixel perfect. My problem is my player view is either too small or too large
the pixel-perfect camera makes each asset pixel take up a whole number of pixels on your screen
you can't get an in-between zoom because the entire point of the pixel-perfect camera is to prevent that
you can't make each asset pixel take up 1.5 pixels on screen or you'll get tons of flickering
since some pixels will wind up larger than others
pixel art requires careful thought about how large your assets are
is there a way to make my target group cinemachine not zoom THAT far in
found it in the aim settings
with CinemachineOrbitalFollowis there a reason why the center of an axis is not always the exact midpoint between the range? When I check the recentering button the center will update with a new value which is the correct orientation behind the character.
Increase the minimum FOV
or change the Group Framing size
I'm using a tracked target, I can see in the source code that CinemachineOrbitalFollow recalculates the horizontalaxis center based on the forward of the target. Is there a way to trigger an instant calculate + recenter from code? I don't want it to lerp
from what I can see UpdateHorizontalCenter is an internal method and is only called in this case
if (HorizontalAxis.Recentering.Enabled)
UpdateHorizontalCenter(orient);
On the old cinemachineFreeLook component, there was a "Follow" and a "Look At" parameter. now, there is only the "Tracking Target". How can I change the "Look At" parameter on the new Cinemachine Camera component
The gear icon button next to the Tracking Target allows enabling a separate Look At Target
Hi. I've been trying to create a zone that when the player enters, it shakes the camera until the player leaves the area. I have a zone now with a noisesetting but the tremor happens only when the player enters the zone and not continuously. Is there a way to do it through cinemachine itself? maybe with its own script?
Use OnTriggerEnter to enable the shaking and OnTriggerExit to disable it
Do the actual shaking in Update or a coroutine
Hello team!
I am using Cinemachine (XDDDDDDD)
it is a top down camera
and also Confiner 3D for it
it is, like I said a TOP DOWN game, the blue squares are the Confiner 3D
[THIS IS THE IMPORTANT PART]
The confiner is working nicely, however my rotation composer, rotates in both Axis, X and also Y
Only want my camera to rotate in Y```
instead, I would like this as the result.
Camera only rotating up and down...
(Achieved by disabling, Rotation Composer)
I have two solutions in mind.
Having many cameras and toggling them when needed, that way I can control if a camera has rotation composer and many other things.
Or two, having a rotation composer that only goes up and down. <= It is what I would like best
What is the name of the component, inside of the camera?
for example, in this case, Cinemachine Rotation Composer
or it could be Cinemachine Follow
I cannot just do CinemachineCamera.TargetOffset.
I am NOT looking for the CINEMACHINE CAMERA, when looking for those values in script.
I am looking for the specific component that holds those values.
For example this case:
CinemachineCamera and CinemachineFollow
are both the same camera object, but since I am looking for the values in CinemachineFollow,
I need a reference to that component```
Because CinemachineCamera is one component, CinemachineFollow is another component, they are working together, but they are not the same.
public void SwitchCameraPerspective(PerspectiveDirection perspective)
{
Vector3 perspectiveOffset = Vector3.zero;
_topDownCameraFollow.FollowOffset = perspectiveOffset;
}```
Here is for example, how I am needing to change values in the Cinemachine Follow.
I need a reference directly to that component, and not just the CinemachineCamera. Even though, both components are in the same object, they are not the same.
maybe mucho texto, but I hope it helps
the simple solution I would do is just make a child object of the player that moves itself to the player's position except for a hardcoded y position with a simple LateUpdate script. Then make this object the cinemachine tracking target. Done
🤔 okay, that could work
You could actually just use the built in PositionConstaint component for it
instead of setting as a child
and just disable the y axis
- Make an empty object
- Attach the PositionConstraint component to it.
- Set the player object as the only source object in the sources list
- Freeze only the Y position axis (uncheck the other two)
- Click the Zero button, then Activate button
- Set the empty object as your cinemachine target
(ignore the settings i have there)
beautiful thank you, trying it out now!
I don't think it is working,
If you have a second, I am sharing my screen on stream!
I think assistance can be much better in real time
you could show screenshots of what you tried
a position constraint
is is constraining, the position of the camera
I want to constrain the rotation
Which object did you attach this to
right - and then how did you set up the cinemachine camera?
I reversed it
If it's on its own object it will not do anything to the camera itself
wdym by this
I did it, but I took it back to what I had before. Becausse it was not working
but all I did was to change the tracking target
to that Position Constrain
Yeah that's all you needed to do
and it was constraining my position, only Y was moving
that doesn't make sense 🤔
The position constraint constrains the position of the object it's on
no other objects
there's no way this would make your camera only move on the y axis
but it has X and Z frozen
it should have y frozen not x and z
you are making me mad
rotation, not position
is what I need to freeze
I am aware of that
By freezing the Y position of the object your camera is LOOKING at
communication and time will be not good here
the camera will never need to tilt up or down
I have another solution in mind now tho
so it's fine
I will remove the rotation composer, and do whatever I need via script
or, if there is a Rotation Composer, that only rotates up and down please let me know
whenevre i add cinemachine cam, the character rotates crzily
crazily
as if the cam has influence in physics
did you place the cinemachine camera ON the player object?
child of player
dont do that, it should be its own seperate object with cinemachine
how do yutube tutorials succeed by tricking me.........
like that?
yes
set the tracking target in the camera to the player and it will still follow it
i did that, now its on the ground
probably becz root is on ground
and idk how to remove these blue lines with the yellow square
do i have to make a separate LookAt block?
you can set an offset of y=1
set position control to follow and then in the component that appears below you can set the follow offset
the yellow square is just the follow damping
they will disappear once you havent selected the camera
same issue
Can you show the full components?
play with the offset while you are ingame, it should update live
this is a better img for the 3rd img
ok on it
btw the cam rotates following my mouse
how to disable cursor tracking
oh ill remove it
wait ill check my project that has a similar setup to yours
alright
this is my current setup
the Target Offset down in the rotation composer sets where you look at
hmm ill try
Btw you can turn off the lines and the yellow thing by switching the "Game View Guides" in the main component
Ping me if you need further help, otherwise I might not notice followup messages 😄
character cant rotate at all despite this code exists
if i wanted a script to disable all cinemachine mouse movement, how would i do that? is there a better way then disabling/enabling the input axis controller component
What's wrong with that approach?
To anyone who has played arma 2 or similar, how does one achieve a view/headbob like in arma 2? I cant seem to be able to deconstruct exactly each individual movement of the camera in this
Assuming this can be done with cinemachine btw, i think the noiseprofile might play a big role but im unsure
ok i made something that seems similar, movement on x and y axis and some tilting on the z axis
is it possible to change the spline shape on the Cinemachine Orbital Follow component?
this curved U shape
i know there is a slider to change how curved the line is but it doesnt change the overall shape of the spline
also are there any games that use the three ring type of camera?
i cant think of any games using it
Hello, when i am working with cinemachine i am getting something wrong it pissed me off, like when using the third person aim camera it's just not rotating and i am trying to add pan tilt it just rotates around it self and not like beside the player so it will get that aiming style.
Any idea?
is there a way to get this camera style?
also how do i turn it on/off in the editor i know wahts causing this but i dont know wehre unity has the button for it
its lso on the top right corner ig just click it
waht is lso
click this to disable this camera style
Isometric ^
Actually, i cant seem to get it right. Is there a chance there might be some sort of random noise applied as a layer too?
you mean you want your game to look like this? Set your camera to be orthographic
Would anyone be willing to help me figure out my third person camera? i went through multiple different tutorials and i cant get the mouse to control rotation
you should show what you're trying right now and what's going wrong
okay
Something about my look orbit input is off making the mouse not rotate the camera
your cinemachine axis controller is disabled
ohhh my god
i enabled it and it didnt change anything. that wouldve been embarrassing if that were it
which object is that attached to? What other components are on it?
my free look camera is targetted to an empty object within my player called CameraTarget that is positioned in my characters head and i have not put any other components on the free look camera
I'm asking what other components there are. You said "free look camera" - I specifically want to know what components you have making that up
It's obviously not just a Cinemachine Input Axis Controller
so im following a definitely better tutorial but im still getting the same issue. I restarted completely from scratch and whenever they add the character to the cameras follow, it allows them to move the camera with the mouse, but for whatever reason, mine doesnt. Is it possible that its because my character isnt a rigid body?
no the components on the character are not relevant
can you show how the rotation composer is set up here?
what confuses me most though is that it just seems all that has to be done is create the camera and set a follow for it to work
wouldn't you not have a rotation composer for a free look?
the rotation composer forces it to look at the tracking target, doesn't it?
or... hm maybe i'm slightly confused. Is it the Free Look modifier that is supposeds to handle this?
The Look orbit X and Look Orbit Y - are those coming from the Free Look modifier, or where
Oh wait it's the Orbital Follow
I forgot - yeah it's not really the rotation that's the issue it's the orbital follow position
I'll disable it and see what happens
no i think it's actually useful/needed - but seeing the orbital follow might help. not sure
yeah it is
i messed with the free look modifier and it is not it
i made a new free look so I havent set those up. But I shouldnt have to because cinemachine defaults them. But each time I have, it hasnt worked. They came from input manager
so what would I have to do for it to allow the mouse to control the camera?
is this relevant?
its a component under my player
Would you be willing to help me through screen share?
nah
No, those are not from the input system. Those are "driven axes" from cinemachine
those are the axes that the input is driving. They come from the orbital follow component:
I dont understand why my mouse input isnt doing anything then
I'm not sure either unfortunately.
would my cursor not locking in the game tab be a reason?
it doesnt do it automatically, I had to make a script to do that
it technically shouldn't matter... and yeah you always would have to do that in your own script
alright
if you try binding this to a different input does it work then?
like try making an action with jeyboard inputs and see if you can get that working
would this be the right way to go about that?
and placing that in these?
yes
i found something very interesting in doing that
actually not very interesting
at first i thought it didnt move the camera but the values were still moving but it was actually moving the camera, just very slowly
ok maybe that same thing is happening for the mouse
If you expand the Driven Axes in the Axis Controller are there settings for senstivity etc
if there are, its not explicitly called sensitivity but here it is expanded
im assuming it might be input value?
it's called Gain
oh ok
If you turn that way up what happens
make it like 10
or 100
Do you have a very high dpi mouse
im using arrow keys because mouse wasnt working but turning it up to 100 made it more of a moderate speed
i would say its average
So im guessing the issue is the way im making a mouse input since arrow keys work when I bind them. How do I correctly make mouse inputs?
what you have should be fine afaik
You should try using the input debugger
This is what I see that is typically used for mouse input
This is your problem
You're using a control scheme and you haven't added this binding to it
do i jsut check the box? because I did and it did not work
make sure you save the input asset after you check it
TBH I would recommend just deleting all of your control schemes unless you're doing local multiplayer
really?
The purpose of contorl schemes are to allow the input system to group the input devices into usable sets of devices to be assigned to different players
if you don't have multiple players locally, it's kinda pointless
do you mean just schemes specifically or input actions assets as a whole?
control schemes
i dont remember even creating it
how do i get rid of it?
In the top left of your actions asset there's a control schemes dropdown
use the delete control scheme button after selecting the one you want to delete
I dont think I have any
don't you have the one called "New Control Scheme"
i really dont know
Seemed like you did from your earlier screenshot
if I do, nothing else used it like my WASD and space
what shows up when you open that dropdown?
but also, making my mouse input under the scheme did not allow it to move the camera
the "All Control Schemes" dropdown?
yes
indeed
i thought it was an option for making one
shouldnt this work?
I dont know if im missing anything, but it does not
i should think it would work yeah
try the "Save asset" button if you haven't already
i have
i tried ramping the gain up a lot more too
actually wait
can you try this
i didnt think it was a sensitivity issue because the values didnt move even a little bit
wait nvm - you said it worked with the 2D vector action with the keyboard right?
this setup - that was working?
yes it was
I would try the input debugger
make sure the mouse input is actually being read properly
where can i find that?
found it
how do i use it?
device is disabled?
i enabled it and it doesnt seem to be redisabling
so is it working now
no
wait it does
i switched back to keyboard inputs to see it work again and forgot to switch back
thank you for your help!
Hello, when i am working with cinemachine i am getting something wrong it pissed me off, like when using the third person aim camera it's just not rotating and i am trying to add pan tilt it just rotates around it self and not like beside the player so it will get that aiming style.
Any idea?
any help on this?
how do I get the padding to be smaller on the confiner?
hi, can anyone help me? I wanne make a 3d game with a 2d game style like signalis but the camera keeps being weird when it is colliding with my pro builder objects or any objects at all, the box is just the player: I am using a virtual camera that cannot be rotated, and i am also using a collider
yes its supose to be pixelated
i want it so the place will just become black
you're going to need to get way more specific about what you mean by "the camera keeps being weird"
a video might help, as well as an explanation of how the scene is set up, how your camera is set up, and what the desired camera behavior is
sure gimme a sec
instead of wobbely lines it shoulkd have just been a black sky just like in signalis
well that part has nothing to do with cinemachine
that's just your actual unity camera settings
check the Background type under Environment
set it to Solid COlor instead of Uninitialized
sure i try
do you mean these cam settings?
cuz i am prob blind but cant seem to find it
ok you seem to be using built in render pipeline instead of URP
but yeah your Clear Flags being Solid Color is correct
check what they are set to while the game is playing
maybe something is changing it
perhaps the CM camera (i forget if it has those settings)
hmm i found the problem i think
so i am using for the pixelated look a render texture
but its interfering with the camera in the wrong way and that is making those weird lines
the settings for that is this:
right... and you are rendering the render texture how?
by putting it in target texture in the camera
no that reenders the camera to the texture
that doesn't explain how you're drawing the texture on the screen
presumably you're using a RawImage component in a canvas
oohhh ofc, sorry i aint very good with unity yet so i dont always know what you mean, but yea i am using a raw image
righ tso... show how your canvas is laid out
probably you can fix this by adding a black image underneath the rawimage
I don't know if this question is best suited for the Cinemachine channel, but I'm using a cinemachine camera, so I hope it's fine.
I'm working on the player menu/inventory and I'm zooming the camera in right over the player's shoulder.
How I'm doing this rn is by disabling the Cinemachine camera component and moving the actual camera, then when the player leaves the inventory, it turns the component back on. This makes it snap back to the last position, which just looks bad, is there a way I can get it to move back smoothly?
Kinda the main point of cinemachine is not having to do that to move the camera
You disable CM cameras but always have at least one and let the blending be done by the Brain
https://docs.unity3d.com/Packages/com.unity.cinemachine@3.1/manual/concept.html
I recommend reading the first few pages of the documentation at least
Well written and really helps you use the system at what it's powerful at
Transitions especially relevant here
So I just put an extra Cinemachine camera where I need it to be, and the camera will blend to it when I switch between them?
Yes
There's a couple of ways to configure how cinemachine chooses the active CM camera, and the blends are configurable too by context
my room just feels so flat, and not of the fact that there is nothing there yet, its just the perspective of what i want feels wrong. Is it because of the map or because i have forgotten something with cinemachine.
the third image appears to be either a perspective camera or they've done a few sneaky tricks with the environment to create the appearance of perspective
notice that you can see the side walls on both sides of the room (and that little inset at the top), despite the fact that the props mostly seem to be 2d sprites
mmmm i can try to make it work with persepctive to see if it will work
it's some odd mix of perspective, 2d sprites, and a 3D environment from what I can tell
hard to say exactly what they're doing here from this one image
fair enough
i tried to use perspective but it does not really feel the same
you could move the camera further away and reduce the FOV
to make it more orthographic-like
it is quite a challange but i hope it will work
do you know if unity provides a system that makes the camera follow the player only when they are out of view? Kinda like what happends in this game aswell, i am trying to make my own game with this style
A classic survival horror experience set in a dystopian future where humanity has uncovered a dark secret. Unravel a cosmic mystery, escape terrifying creatures, and scavenge an off-world government facility as Elster, a technician Replika searching for her lost dreams.
For NSFW Content: Patreon: https://www.patreon.com/TheBaldMan
If you enjoy...
yes you can set up cinemachine to do this with dead zones
or with clearshot and multiple cameras. depending on what you're looking for
i shall look into it thank you!
Is there any way to lock camera rotation ?
Disable whatever component is rotating the camera
Could blend to another CM camera which doesn't have rotation
I think there's an option for the destination CM camera to inherit the source CM camera's rotation/position, but I don't recall what it was called
how to correctly setup cinemachine pixelperfect to smoothly move
Cinemachine or not, pixel perfect cameras generally cannot move smoothly
All motion must be snapped to the pixel grid, and the slower and less linear the movement is, the more jarring the snapping will be
This problem is even worse when the camera is following a sprite that's also snapping to the pixel grid, but with a slightly different timing
Somehow fixed, but character sprite, when moving vertically jitters
When using the character controller for a player, is it ideal to even use cinemachine since you're making a camera controller regardless
What does one have to do with the other? What do you mean by "you're making a camera controller regardless"?
I thought that if you're making a character controller, you will need camera controller, I thought cinemachine with the character controller would break
No?
Where did you get that idea
they have nothing to do with each other
Oh ok
Sounds like maybe you 're not actually asking about CharacterController. You're asking about first person shooter style games. CharacterController is not limited to FPS games.
As to the question about cinemachine - even if you are 100% coding your camera yourself, I believe it's still worthwhile to use CInemachine in every game because it gives you access to the benefits of using multiple cinemachine cameras, blending between them, etc.
I agree with using cinemachine, my question was phrased wrong, I thought having character controller and cinemachine would not work
Yeah that sounds like a misconception you picked up somewhere
How do I use cinemachine to make a screen shake effect that shakes the camera in random directions?
Noise profiles can be defined to affect any axis you want
Importable examples should demonstrate how to use noise as well as impulses
How do I set noise profiles?
Then what are impulse sources and impulse listeners?
https://docs.unity3d.com/Packages/com.unity.cinemachine@3.1/manual/CinemachineImpulse.html
The page I linked links directly to this page which answers those questions exactly
Well, I can set an initial force and time for the shake, but how do I set the noise for it?
Noise profiles are used to apply noise to CM cameras
Impulse Sources instead have a Shape that defines how the impact jolts the camera
Impulse Listeners additionally can use a noise profile to mix in noise with the received impulses
You can either blend in to and out of a CM camera that has noise when you need shaking, or do a similar thing with impulses
It's depends on how you want to introduce the shaking at runtime
Impulses can guarantee the motion starts sharply, but noise alone is easier to make continuous
I just want the camera to shake in all directions for a few moments when something happens
That's a too vague description to point to either system as the better choice
Both can do that
I want to use the impulse and listener system
You can go ahead and do that
I recommend downloading the examples from the package manager as a reference implementation
I'm quite new to cinemachine and currently I'm trying to make a first person cutscene for a school project.
I'm trying to animate the character running however, the cameras that I'm using keep forcing a slow in/slow out effect and it's adding an ugly stutter to my animation (I'm sure any experts or even intermediates here know what I mean).
Currently I'm just using static cameras, but I'm wondering what would be a good alternative to making a first person running scene.
Would a cinemachine cam following a spline work better? Are there any alternatives that have been used?
I've been looking around on forums, yt, reddit, stack overflow, etc to find a solution but haven't come across a definitive one yet.
The video is what I've got right now.
honestly. Should I only be using one camera and animating the character? I feel like that would be a much more effective system
Maybe use a dolly track?
You don't want to use multiple cinemachine cameras, for sure. It will be very hard to get them to blend together the way you want
Praetor's suggestion is the way to go
Yeah, I was just being stupid, instead of using cams Ive just been animating the model and getting it to move while making the cam follow a specific bone on the model.
Thanks either way!
using cinemachine for the first time and was wondering, is there a way i can make it so the free look camera only moves when the player left click and drags instead of anytime the mouse moves?
Disable/enable the cinemachine input provider component as needed
ill take a look at that thank you
Alternatively, you can create an input action that only fires when the button is pressed, and map that to the CinemachineInputAxisController instead of the default mapping.
so in my game, I have a freelook camera (orbital follow), and a scoped in camera (third person follow), that the player can toggle by scoping in.
for some reason, when transitioning back to the freelook camera ('scoping out'), the camera 'rubberbands' back and forth a bit, but interestingly only when the player is moving towards the camera.
(.gif attached. in this example the transition is set to 1 seconds so the 'rubberbanding' can be seen more clearly, but normally it is only visible for a few frames).
the scoped in camera (third person follow) is driven by its tracking target, which effectively copies the rotation of the freelook camera (which is drive by the player's inputs). this is to ensure the two cameras have the exact same position when scoping in and out.
in the inspector I can see that it is the gameObject that is the scoped in camera's tracking target that's wiggling around. but I'm not sure why, since it simply calculates its own rotation based on the horizontal and vertical axes of the freelook camera:
void Update()
{
float yaw = Cam_Freelook.HorizontalAxis.Value;
float pitch = Cam_Freelook.VerticalAxis.Value + PitchOffset;
transform.rotation = Quaternion.AngleAxis(yaw, Vector3.up) * Quaternion.AngleAxis(pitch, Vector3.right);
}
but the axes of the freelook camera do not change during the rubberbanding, which is very strange, as it means that the update code above should produce the same rotations (which as we can see is not the case: the tracking target wobbles around). I've tried ensuring the script executes after all cinemachine scripts, using LateUpdate() etc but this still happens. this must mean that something else is modifying the rotation of the tracking target, (does cinemachine modify the position of a camera's tracking target somehow?)
if I debug.log the transform.rotation of the tracking target inside Update(), and then debug.log it again inside LateUpdate(), it is different, showing that another script is clearly modifying it.
Are the CM cameras parented under the player character transform?
no
Or under anything else that moves or rotates?
I'd also try to eliminate all scripts that could be changing it in Update
Any Animator ever touching the CM camera transforms or transforms or their hierarchy?
ah, that's it! the tracking target (that the above update loop is on) was a child of the player, and so it was inheriting their rotation as well
just have to figure out a way to get the scoped in camera to copy the position of the player again smoothly, since the above script has to execute before cinemachine's scripts to get a smooth rotation (which isn't a suitable time to copy position without jitter)
managed to get it working using a target group. position is controlled via the group members, then I just added my script to the group object and used manual mode for rotation
{
Vector2 mouse = input.mouseGamePos;
aimCursor.rectTransform.position = mouse;
aimCursor.rectTransform.Rotate(0, 0, Time.deltaTime * rotateAimSpeed);
eyeball.up = (mouse - (Vector2)transform.position).normalized;
Vector2 bodyPos = transform.parent.parent.position;
if (Vector2.Distance(mouse, bodyPos) / 2 < maxAheadDistance) camFollow.position = (bodyPos + mouse) / 2;
else camFollow.position = bodyPos + (mouse - bodyPos).normalized * maxAheadDistance;
}``` camFollow is the cinemachine's tracking target. camFollow is a sort of a lookahead for the player so the camera can move in the direction the player is looking at with the mouse. I was wondering if there is a better way of setting camFollow's position, or a different way to achieve this altogether.
This way doesn't seem correct to me
When you do (mouse - bodyPos) you're subtracting the mouse's screen space position from an object's world space position
The correct way would be to get a world space position corresponding to the mouse position first
and the way to do that would be with Camera.ScreenPointToRay to create a Ray and then using Plane.Raycast with a Plane constructed to match the 2D game world plane.
Can someone have a look at this
https://streamable.com/7b7ku1
I have no idea why there's such a shaky camera movement when i walk around. The other rooms don't look so janky but the rooms near the corridor (0.33 second) looks like the camera has a very obvious "jump"
If you look at the end, around 0.54 I show what the room layout is supposed to look like (Even then, it seems that the cinemachine camera is not following my bounderies, why is it looking past the boundaries i set
You need to share details about your scene such as how your player movement works and how the camera is configured