#šŸŽ„ā”ƒcinemachine

1 messages Ā· Page 10 of 1

royal tartan
#

because of the deoccluder presumably

#

it thinks the new collider you added is blocking the view

candid harbor
#

i figured it out, it had something to do with the deoccluder component in the Freelook Camera

royal tartan
#

I mean yeah, just the deoccluder doing its job

candid harbor
royal tartan
#

These settings let you control which things it considers blocking

#

you'd want to either tag the new collider with "Player" or add it to one of the "transparent" layers

candid harbor
#

yeah, setting it to Untagged solved the issue

royal tartan
#

then it's going to ignore anything that's untagged which probably isn't what you want

#

but uhh, you can always change it

candid harbor
#

yeah that was the plan, change it when i need to, that's future me's problem

#

thank you for your help :)

viral girder
#

Hey all. I was happy to see that Cinemachine has Splines integrated, but I have found the Automatic Dolly with NearestPointToTarget behavior to be a bit disappointing because I want the camera to have to stay on the dolly track rather than jumping the track to get to the nearest point.
Is there a built-in way to get that behavior that I have missed, or would it require cooking up my own script?

#

I thought maybe using the Spline Dolly Cart would do it, but it seems to behave the same as the the Dolly camera, except worse because there are no damping parameters

#

The first part of the video is the built-in jump-the-track behavior, but I would like for it to behave as it does when I manually set the poition in the second part of the video.

#

I don't really feel like making my own script for this so I hope there's a way (I'd like to think I don't need to customize the tool but instead just need to learn how to use it better), but I might just end up experimenting with multiple splines and dolly cameras

viral girder
#

Now I am doing it and am reminded that working with the Spline package in code is a PITA.

ivory wraith
#

It sounds like you want to calculate the nearest point on the spline and then use Mathf.MoveTowards or Mathf.SmoothDamp to make the cart's position approach that point

viral girder
#

Well, that will make it move off the track still

#

Because in the case of bending

#

Trying it myself made me realize why it behaves how it does

#

But I think if I used progress/time from the spline and get that position then I can force the interpolated position to stay on the track rather than interpolating a jump off the track

#

Basically I do want it to interpolate to the closest spot, but if the closest spot compared to the last closest spot becomes a large distance on the spline, the position interpolation should stay on the spline rather than going straight toward the new closest point

#

Like a real track would work

#

But for this project I think I'll just use multiple dollys and cameras

viral girder
#

Okay new Cinemachine issue. I am attempting to run some callbacks when a certain CinemachineCamera becomes the main one or not.... I'm trying using CinemachineBrainEvents, but the interfaces passed into those events are opaque... For example:

CinemachineBrainEvents.CameraActivatedEvent passes along ICinemachineMixer, ICinemachineCamera

I can't find in either of those how to get a reference to the object that owns the camera that activated.

Any help much appreciated šŸ™

royal tartan
viral girder
#

It’s an interface

#

Actually

#

I should double check that. I assumed it was an interface due to the naming convention

royal tartan
viral girder
#

Hmm. So should I just cast it to GameObject?

royal tartan
#

You can probably just do cs if (theThing is CinemachineCamera c) { Debug.Log($"switched to {c}"); }

royal tartan
#

It's one of the components on the GameObject

viral girder
#

err rather cast it to CinemachineCamera

#

Yeah

#

Hmm okay I will try it. Thanks.

viral girder
solar stream
#

bit of a conceptual question....
I have a third person game where you can scope in, and I'm adding in an aim assist feature for controller/gamepad.
I have it working for the game character (rotating them to face the aim assist target, raycasting for bullets towards the aim assisted gameObject etc) but I can't wrap my head around how to do it for the camera.
I can't set a custom rotation for the camera every frame (assuming this is because it gets overridden by camera's normal movements). I also can't change the cinemachine orbit camera's target, since that needs to stay as the player.
is there some way to add a 'hint' or target transform that the camera will try to keep in the center of the screen? (separate to the tracking target ofc)
or any other way to approach this problem, haha

modest flume
royal tartan
ivory wraith
#

It looks like you're cutting between the two cameras

royal tartan
# solar stream bit of a conceptual question.... I have a third person game where you can scope ...

I can't set a custom rotation for the camera every frame (assuming this is because it gets overridden by camera's normal movements). I also can't change the cinemachine orbit camera's target, since that needs to stay as the player.
is there some way to add a 'hint' or target transform that the camera will try to keep in the center of the screen? (separate to the tracking target ofc)
The Follow target and LookAt target are two separate things.

#

You can also use a Target Group if you want to the camera to look at two separate things at once and keep them both on screen.

solar stream
royal tartan
#

LookAt target and TrackingTarget

#

You have to press the little gear @solar stream to enable the separate look at target

solar stream
#

oh brilliant, thank you

late basin
# solar stream bit of a conceptual question.... I have a third person game where you can scope ...

Take a look at the ThirdPersonWithAimMode sample scene that ships with CM3. It sets up a camera to do exactly what you describe. It even shows how to get a steady aim when the camera has hand-held noise. Notice how when the player fires in aim mode, the bullet always goes exactly to where the camera reticle is.

It's not trivial to do, and requires co-operation between the camera and the character controller. The sample scene shows how to do it in such a way that blending with other CM camera is cleanly and non-hackily supported.

late summit
#

how do I use that pixel per unit size and change the size of the camera without effecting pixel per unit size? I also have Vcam

deep lagoon
#

Hey guys! Is it possible to have a Cinemachine Blender Setting that can be a different value depending on situations?
We want one of our blends to be a seperate time based on the size of a map in our game.

late basin
deep lagoon
#

Thanks for getting back to me. Would this also be the case if I'm using custom blends instead of default?

late basin
deep lagoon
#

Thanks

#

Have been attempting to read docs on this event and I'm a bit confused. Is there a way to subscribe to it or hook into it so that when the desired blend between virtual cams is happening, I can alter how long it's last for?

#

It says I can add listeners which is probably what I want but it doesn't say how.

late basin
#

You can also do it via the CinemachineCameraEvents behaviour.

deep lagoon
#

Oh no, we're using Cinemachine 2.9.7
That's why I can't see these. :\

late basin
#

It passes you the blend it's going to use, and you can return it as-is, or return a modified version.

deep lagoon
#

I also found an old forum post where I think you answered someone else about this delegate so now I know how to use it too. Thanks!

rugged iron
#

Hello!

#

I have a big problem

#

for a head bobbing effect, I use an impulse listener & an impulse source, coupled with a noise setting that emulates a head bob, set in the listener's "reaction settings".

#

On each session, the head bobbing strength is different.

#

I cannot understand why

#

Only one script changes the amplitude gain (*= -1), but this is not the problem, it works for changing the bob from left to right

ivory wraith
#

Are you rapidly firing many impulses from the impulse source?

rugged iron
#

No, only one each ~1 sec

#

the impulse itself, and the reaction, lasts for 0.4 sec

ivory wraith
#

Okay, so it's probably not a framerate dependency

rugged iron
#

I honestly have no idea how anything could go wrong here. The impulse source is exactly at the same point as the listener

ivory wraith
#

Well, the impulse will stay at the position you fired it from, I'm pretty sure

rugged iron
ivory wraith
#

(well...kind of sure)

rugged iron
ivory wraith
#

ah, yes

rugged iron
#

(here's everything)

ivory wraith
#

I would try adding a noise component to the Cinemachine Camera (and not firing any impulses from the impulse source). Does it behave the same from run to run?

rugged iron
#

I had one already, and just tested it multiple times as you asked: same behaviour from run to run

#

For the first time now I've had a new problem, where only the position X movement happened (not the rotation Z)

#

This is extremely strange

#

I change nothing between each run

ivory wraith
#

i wonder if it's just random? notice that "non-random wave if checked" bit

rugged iron
#

holy shit

#

Maybe because I have frequency at 0, the random is applied only at initialization

#

I'll test

#

no idea why my eyes always saw "random wave if checked"

#

Well that was it. Thanks. I'm tired lmao

ivory wraith
#

Ah, that would make sense! It's a wave with a frequency of 0

#

So it's a constant

#

I was wondering why there weren't any squiggly lines in there

rugged iron
#

During a run, it kept the same, so I thought I had already made it non-random

fiery harness
#

Hello i have an issue with cinemachine and pixel perfect camera, so when i set the upscale render texture setting everything works as intended but without it cinemachine ignores the pixel perfect resolution and sets its own orto size. Can someone please help? (i heve the cinemachine pixel perfect extension)

modest flume
royal tartan
fiery harness
worldly mountain
#

where is the cinemachine body section in unity 6?

#

whats the replacement for framing transposer or one similar to it

royal tartan
#

If you want a transposer, add a transposer

worldly mountain
royal tartan
pliant onyx
#

I have multiple main cameras but I specifically want to divide out what camera can blend to what virtual camera (think split screen). I'm not seeing any specific masking for this problem, anyone any ideas?

#

Sucks that it's bound by physical layers like everything thing else in unity

late basin
late basin
late basin
pliant onyx
#

I've a habit of grabbing the answers off google and not checking the current version ;p

wheat herald
#

Hello! I'm having a problem where a world space UI canvas is registering my cursor based on the main camera's "actual" position, instead of the cinemachine camera controlling it. My understanding is that the cinemachine camera takes control of the main camera and repositions it. So how could this be? Or has something changed since the Unity 6 update? Becuase I used the very same canvas and setup before Unity 6 and it wasn't a problem then. Does anybody have any ideas?

ivory wraith
#

The actual position of the main camera is what determines what gets rendered

#

I don't understand what this would mean:

a world space UI canvas is registering my cursor based on the main camera's "actual" position, instead of the cinemachine camera controlling it

late basin
ivory wraith
#

That could produce a dramatic error if something else is moving the real camera around early in the frame

#

I remember a long discussion about something very similar recently..

#

the camera was getting moved several times per frame

wheat herald
# ivory wraith I don't understand what this would mean: > a world space UI canvas is registeri...

Ah, what I mean is that the main camera (as well as the main cinemachine camera) is positioned at eye level as part of the player gameobject, but a secondary cinemachine camera is positioned in a different spot, in front of a screen that is the main menu, rendered as a world space ui canvas. The menu camera (secondary cinemachine camera) has higher priority and controls the main camera when the player is in the menu, but when hovering the cursor over ui elements, there is an offset to whether it is recorded as being over a button or not. I have to place the cursor slightly below and to the right of the button for it to register. As I transition back from the screen camera to the main cinemachine camera, it becomes clear that the world space ui is somehow using the main cameras regular eye level position to determine where the cursor is, because when the primary cinemachine camera is in control, the ui registers the cursor correctly. This seems strange, because the assigned event camera in the canvas is the main vamera, which should be in the position of the menu camera when the latter is in control.

wheat herald
wheat herald
late basin
wheat herald
late basin
wheat herald
#

Here's the inspector for the menu camera:

#

Here are the cinemachine components of the regular cinemachine camera (The one that controls the main camera when not in the menu) in case it's interesting:

#

As well as the cinemachine brain:

late basin
wheat herald
#

The primary cinemachine camera, which controls the main camera when not in the menu:

#

The menu camera:

#

The actual main camera, being controlled by the menu camera:

#

AS you can see, the main camera is in the right spot, but UI events are still seemingly being calculated based on its original position.

#

It's a bit hard to explain in images, but in this image, my cursor is actually hovering over Controls

#

And when pulling back the camera, the UI calculations fall into place, and from this position the cursor is actually over Play, as it should. It's clear during the camera transition that the UI "thinks" the camera was in this position all along.

#

I've done everything I can to troubleshoot the UI, but as far as I can tell, it really is set up the way it should, and this set up has worked before. Also, the same problem occurs when creating a world space UI from scratch. The problems only arise when a different cinemachine camera from the usual one takes control.

errant shard
#

@wheat herald Do you have more than one Camera component?

fossil vector
#

is cinemachine virtual camera still a think or is it removed?

royal tartan
vivid sedge
#

Hi! I have a virtual camera tracking a target group (two characters having a conversation). I want the virtual camera to position and rotate itself so that it's always aiming directly in the middle of both characters, and far enough away to capture both characters in frame. Can anyone help me with with the settings I need to use for this?

#

Essentially this:

#

These are my current settings:

#

It currently keeps both targets in frame, but it doesn't rotate around them

wheat herald
errant shard
wheat herald
#

I agree, none of this should be happening haha

errant shard
ivory wraith
#

You can filter for Camera components with t:camera

#

searching for camera will give you camera components, plus anything named "camera"

thin crypt
#

Hey there.

I'm trying to replicate the camera that give the planetary view of Dyson Sphere Program with cinemachine. But i'm getting a gimbal lock like effect on the pole when I would just want the camera to forget about keeping the north pole of the spehere at the top of the camera.

Is it possible ?

#

Example of what i'm trying to get

royal tartan
thin crypt
#

this is the config

#

I tried playing with almost all setting , but I don't find a way to make it ignore the rotation at the pole

#

a pan & tilt rotation controler don't care about that but do not look at the sphere at all

ivory wraith
#

You need more information.

#

Orbital Follow figures out a rotation from your position alone

#

but that, by definition, is going to cause the camera to abruptly roll around as you go past the pole

#

the only input here is the position

slow niche
#

Hi may I check e.g for the "Horizontal" input as seen in this screenshot, how does cinemachine know that it is meant to rotate the camera based of that input?

#

Is "HorizontalLook" a default cinemachine name/enum?

royal tartan
#

it has the axis name configured there, e.g:

slow niche
# royal tartan

Do you mean cinemachine automatically identifies "Mouse X" as an input meant for rotating the camera around the player?

#

I'm actually wondering how does it know what to do with the particular input

royal tartan
#

the one you screenshotted

#

As you can see the different axes are configured to do different things

#

There's nothing automatic - it's configured right there in your screenshot

slow niche
#

I've dug into the code for abit and found this

royal tartan
#

it will only show things that are relevant

slow niche
#

But this seems to only give it the name of the inputs and not the exact exact action e.g "Jump". Additionaally I can't seem to find "Horizontal Look" anywhere in the code

royal tartan
#

It's only showing aim because you probably are missing other components that would care about other things

slow niche
royal tartan
#

Never said that

#

What are you trying to accomplish?

#

input axis controller is for controlling cinemachine cameras.

If you're trying to do somethign unrelatd to camera control you needn't worry about it.

slow niche
#

The sample scene which I've copied the camera rig from is the above ^

#

I'm not using any of the Player scripts from the sample scene above ^

#

I hope to achieve a similar effect as the sample scene with the same Camera Rig setup ^ but with my own custom player components

#

hence firstly I'm figuring out how to make that "Free Camera" move and rotate (around my player object) with the mouse

#

Basically the "Free Camera" should behave somewhat similar to a Free look camera

royal tartan
#

You can start from the cinemachine menu with one of these:

#

it should give you a somewhat working thing to start off with

#

Either FreeLook or Third Person Aim

slow niche
royal tartan
#

no idea, I didn't write it

slow niche
#

I was initially using the free look camera but couldn't get the third person aim camera to work because it requires another set of mechanics (To rotate the camera and the Player Object with the mouse (Only in aim mode))

#

So because of that hurdle, I chose to try out the one from the unity sample above which has the desired effect I'm looking to achieve

#

But it seems that the one used in the sample requires using the sample player components to work

steady estuary
#

Hi all. Cinemachine 3.1.2, using Unity Starter Assets 3rd person for prototyping. I like the Third Person Follow that it comes with, but don't understand how to apply rotation constraints. As currently configured, the player can rotate the camera 360 degrees around the player. How can I constrain that so that they can only rotate say -+ 25 degrees relative to the character's forward?

static pendant
#

Hi everyone, I am making the cinemachine follow the player. My player has a RigidBody, so due to that whenever my player meets physics-based interactions like falling down, or just exhibiting physics in general, my cinemachine camera reacts to that and sometimes unfollows where my player is going, or sometimes shakes

steady estuary
steady estuary
#

No harm in experimenting until someone who knows better can give you a definitive answer. Just note what your current method is so you can revert to your starting config.

static pendant
#

late,smart, fixed , nothing did fix

steady estuary
#

then you wait

#

sorry it didn't work out

static pendant
#

its fine, thanks for the input tho

late basin
# wheat herald I've done everything I can to troubleshoot the UI, but as far as I can tell, it ...

Also, the same problem occurs when creating a world space UI from scratch.
Can you make this happen in a small test project? If so, please do it and send it to me. That might be the most efficient way to debug this. What others have said is correct: canvas UI knows nothing about CM cameras, it just raycasts off of whatever Unity camera. If CM positions your camera somewhere, then UX will be based on that camera's position, full stop.

late basin
wheat herald
late basin
# vivid sedge

Your settings are telling the camera the camera to look at the group and to be a certain distance away, in a direction determined by the camera's rotation. There is nothing telling the camera to move (unless the target group is moving). What exactly do you want the camera to do? Gradually move in an arc around the group while looking at the group?

late basin
wheat herald
late basin
vivid sedge
# late basin Your settings are telling the camera the camera to look at the group and to be a...

No, I want the camera to remain static, looking at the two characters side-on perpendicularly. The camera only moves if the characters move. I managed to implement this by creating a custom script that rotates the target group transform to be perpendicular to the vector between the two character transforms. Then set the virtual camera to rotate with follow target. Works exactly how I wanted, although it would be nice if Cinemachine had an option to do this out of the box. The target group already has two options for rotation modes: Manual and Group Average. Adding "Perpendicular" would be nice, but I guess it might not work properly for more than 2 targets.

late basin
late basin
vivid sedge
late basin
# slow niche I see so basically if I want to use input axis controller, I must use the sample...

Yes, it is designed to work with custom scripts, and the sample controller script is an example of this. If your script exposes a Cinemachine InputAxis member, and if your class implements the Unity.Cinemachine.IInputAxisOwner interface, then the InputAxisController behaviour will find those exposed axes and provide inspector UX to drive them via user input. That's what the Cinemachine builtin and sample components are doing.

thin crypt
late basin
# slow niche Actually why doesn't the sample above ^ uses the free look camera?

The problem with the FreeLook camera is that it's not really good for imlementing an over-the-shoulder type camera with precise aiming. The Third Person Follow component is designed for this, but it does need to be controlled differently. The sample scenes show how to do this. You can copy the code and use it for your own custom controller scripts.

late basin
late basin
static pendant
#

And set it to fixedUpdate made it much better

#

tbh

static pendant
#

I also made a child object which camera follows so it avoids the rotation and extra physics

late basin
# static pendant tbh

Instead of putting the brain in FixedUpdate, try enabling Interpolation on the RB. That will convert the motion to be LateUpdate-compatible and you can use that in the Brain. It will give smoother results.

static pendant
#

game dev in the end is just trial and error, sometimes it would work, other times it wont

late basin
static pendant
#

moveDir = new Vector3(inputVector.x, 0f, inputVector.y);

#

ig its correct

late basin
static pendant
#

yes

late basin
#

is there anywhere else in the code where you're touching the RB's transform? e.e. setting its rotation

static pendant
#

But why shouldnt i keep the brain as LateUpdate?
what difference it makes when its SmartUpdate by default

#

Honetly My camera is behaving GOOD in both

#

Theres no issue right now

late basin
# static pendant nope

Well, if that's true then interpolation should word, and CM will be able to track the RB using LateUpdate, jitter-free. If you're getting jitter then that points to a problem in how you're moving the RB.

static pendant
#

now i am not facing jitter, i think it was because i was making camera track my RB directly

#

I am using a child empty gameobject that gets tracked by it

#

so no jitter as of now

late basin
static pendant
steady estuary
late basin
# steady estuary Ha - that stung because it was my suggestion. I thought ā€œphysicsā€ > possible upd...

Yes, it makes sense. It's important to understand that in Unity there are 2 clocks: Fixed and Render. If your object is moving on the fixed clock (e.g. a Rigidbody), you want cameras tracking it to also use the fixed clock. The FixedUpdate mode is provided for that, but it is a suboptimal solution, because you can end up causing jitter in non-physics objects that are visible on screen, and general stuttering because of aliasing between fixed frames and render frames. Much better to convert the object's motion to be render-frame-compatible (that's what interpolation does). Then, all visible objects animate on the same clock (Update/LateUpdate) and if the camera does that too, there will be no jitter anywhere.

slow niche
# late basin The problem with the FreeLook camera is that it's not really good for imlementin...

I'm finding this system to be quite complex. Is there a more straightforward way to handle this e.g another type of cinemachine camera that will achieve the same effect without the need to modify it via code?

If no, can I check where is, for an example, the "Move X" being handled in the code? Is it a delegate that we pass to cinemachine in which the delegate would contain the function we wish to run for that specific cinemachine input e.g RotateCamera(x, y, z);

From the above screenshot it seems as though "Move X" is passed to the cinemachine controller but there doesn't seem to be anything that will tell Cinemachine what to do with "Move X". Or is "Move X" a keyword/enum that cinemachine is meant to recognize that the user wishes to move the camera based of the specified position?

#

Also since now we would have to handle the actions of the camera by code, does this mean that we have to implement the rotation behavior of the caamera ourself? Since the FreeLook camera is not recommended.

late basin
slow niche
# late basin What camera behaviour do you want?

The similar behavior as seen in the sample where the "Free Camera" rotates aaround the player by the mouse (Similar to what the Free Look Camera is doing) but with the added "Aim Camera". Basically similar effect to the sample scene screenshot below just that I'm using my own player components

late basin
#

I'm using my own player components
What are your components doing that's different from what the sample components are doing?

slow niche
slow niche
#

Unity's Netcode for Game Objects

late basin
#

Do you need to have a precise camera aim mode as well, like the sample has?

slow niche
# late basin What's NGO?

So what I'm understanding first and foremost is that I've to implement my own camera rotation behavior for that "Free Camera" is this correct? Additionally does all these "Driven Axes" requires delegates for the cinemachine to execute or does simply giving the cinemaachine this keyword "Move X" tell cinemachine to run it's own in built function to move the camera?

slow niche
#

The way I fire the bullets are via physical gameobject/projectiles, not the ray cast method to hit the opponent

#

I'm not sure if the sample is doing the raycast method or not, but hopefully this is irrelevant to the cinemachine implementation

late basin
late basin
#

In this video, we’re going to look at how we can set up a third-person camera using the new Aiming Rig of Cinemachine 2.6, and how we can use Impulse Propagation and Blending to create additional gameplay functionality for our camera controller.

Download this project here!
https://on.unity.com/36nVNzt

Learn more about Cinemachine 2.6 here!
htt...

ā–¶ Play video
steady estuary
slow niche
#

I did try to follow the above tutoriaal but couldn't find some of the cinemachine components mentioned in the video

#

I'm using unity 6 and the latest cinemachine version

late basin
slow niche
late basin
# slow niche So what I'm understanding first and foremost is that I've to implement my own ca...

The thing that you need to implement is a script to control the "player aiming core" on your character. That's an invible GameObject child of your player whose local rotation defines where the player is aiming. Your script will control its rotation. That's considered to be part of the character controller. The camera then attaches rigidly to that object.

The CM samples show one way to do this. In your place, I would try to convert them to use Rigidbodies so that they work in your context. Alternatively you can roll your own. There is no need to use CInemachine's InputAxis for input, or the CinemachineInputProvider. CM samples just use those for convenience, but you can do anything you want. The main thing is that somehow you're controlling the rotation of that child aiming object.

steady estuary
#

I understand the intended use case is for when there are multiple cinemachine brains. Is there any reason you couldn't use this for camera organization and to prevent unwanted accidental blends? For example, in my game i have multiple fixed CM cameras in rooms, dialogue CM cameras, cutscene CM cameras, etc. I'm talking strictly as an org tool. Then change the channel mask when I want to lock into something specific, like cutscene. Or am I thinking about this the wrong way and should not think of them like layers, light/decal layers, etc

late basin
slow niche
# late basin The thing that you need to implement is a script to control the "player aiming c...

Does the tutorial cover the implementaation of the invisible player aiming core gameobject? It being in the player object as a children means that I would have to also take into considerations when the player (root*) object rotates correct? Because if the root object rotates, the child invisible aiming core would follow along with it since it is a children and would therefore mess up with the camera's rotation

steady estuary
late basin
# slow niche Does the tutorial cover the implementaation of the invisible player aiming core ...

The tutorial provides code for rotating the child object in relation to its parent, and yes that means that when the parent rotates the child will rotate also, and the camera will go with it. The CM sample code is more sophisticated, and allows you to control how the child object is coupled to its parent. Coupled is what the tutorial implements, and Decoupled is what I think you want. You can just steal the code and use it in your own scripts.

slow niche
late basin
late basin
slow niche
late basin
late basin
slow niche
late basin
slow niche
#

Ah ok so cinemachine is not even handling those inputs

slow niche
#

it's just an added feature

#

Got it! Thanks for clearing that up

rose bloom
#

With Cinamachine, how do you stabilize a first person camera, if its following the head bone of the player (camera itself is completely seperate) idle animation currently both moves and rotates the camera rn.\

echo basin
#

Obviously the camera wouldn't go down if the player kneels down, but ..

#

It would at least not bob and move due to animations.

late basin
# rose bloom

Try adding some Damping to the Rotate With Follow Target component. I assume you're trying to implement a first-person camera that always tracks the position and rotation of the head.

ivory wraith
#

I've gotten really good results by having the camera follow an "Eyes" object that's parented to the head

#

Right before Cinemachine runs, I set the rotation of that object to the desired look rotation

#

This way, you only get translational camera shake

#

And if you only partially fix the camera's rotation, you get a little rotational camera shake

rose bloom
#

Thank you all for the advice, i totally thought the eyes would be affected by the heads rotation, but since im updating the rotation values directly, that doesnt even matter XD.

#

the eyes object was a lifesaver, many other solutions involve "putting" the camera inside the head, but removing it from being affected by animations ENITERLY, which isnt what i want

ivory wraith
#

It has to be after animation but before Cinemachine runs

#

LateUpdate is an appropriate place

void cosmos
royal tartan
#

but uh - it's just the interaction of Framing Transposer and the Composer

#

The Body settings are responsible for the movement part.

void cosmos
late basin
void cosmos
heady spear
royal tartan
heady spear
#

This is the old setup

royal tartan
#

need more context. What's the hierarchy look like? How does this FollowTarget object move?

#

is the follow taret a child or parent of the vCam or something

heady spear
#

which was the same way as before... all i did was updated Cinamachine to 3 and changed the namespace and got a different result šŸ˜„

#

In my code im moving it like this transform.Translate(new Vector3(movementInput.x, 0f, movementInput.y * Time.deltaTime * currentSpeed), Space.World);

late basin
royal tartan
#

it might be better to just share the full script

heady spear
#
{
    // HandleCameraZoom();
    movementInput = inputs.Camera.Movement.ReadValue<Vector2>();
    cam = inputs.Camera.Mouse.ReadValue<Vector2>();
    // Debug.Log(cam);
    if (edgeScrolling)
        HandleCameraEdgeScrolling();

    //Rotation
    float currentSpeed = 50f;
    var rotationDirection = inputs.Camera.Rotate.ReadValue<float>();
    transform.Rotate(Vector3.up * Time.deltaTime * 30f * rotationDirection);

    //Movement
    //ClampCamera();
    //testCam();
    float topSpill = 0;
    float leftSpill = 0;
    float rightSpill = 0;
    float bottomSpill = 0;

    if (frustumCorners[1].x <= clampTop.x)
    {
        movementInput.x = Mathf.Clamp(movementInput.x, 0, 1);
        var frustumePos = frustumCorners[1].x;

        leftSpill = clampTop.x - frustumePos;
        //Debug.Log("X Start");
    }
    if (frustumCorners[1].z >= clampTop.z)
    {
        var frustumePos = frustumCorners[1].z;

        topSpill = clampTop.z - frustumePos;

        movementInput.y = Mathf.Clamp(movementInput.y, -1, 0);
        //Debug.Log("Z Start");
    }
    if (frustumCorners[3].x >= clampBottom.x)
    {
        movementInput.x = Mathf.Clamp(movementInput.x, -1, 0);

        var frustumePos = frustumCorners[3].x;

        rightSpill = clampBottom.x - frustumePos;
        //Debug.Log("X Start");
    }
    if (frustumCorners[3].z <= clampBottom.z)
    {
        var frustumePos = frustumCorners[3].z;

        bottomSpill = clampBottom.z - frustumePos;

        movementInput.y = Mathf.Clamp(movementInput.y, 0, 1);
        //Debug.Log("Z Start");
    }```
#
    if (leftSpill != 0)
    {
        var pos = transform.position;
        pos.x += leftSpill;
        transform.position = pos;
    }
    if (topSpill != 0)
    {
        var pos = transform.position;
        pos.z += topSpill;
        transform.position = pos;
    }
    if (rightSpill != 0)
    {
        var pos = transform.position;
        pos.x += rightSpill;
        transform.position = pos;
    }
    if (bottomSpill != 0)
    {
        var pos = transform.position;
        pos.z += bottomSpill;
        transform.position = pos;
    }
}```
#

thats pretty much it

royal tartan
#

what is this whole "spill" thing

heady spear
royal tartan
#

especially since as the camera moves the bounds change

#

some kind of feedback loop is happening

heady spear
royal tartan
#

start by disabling the clamp code to test if that's actually the problem

#

or turn off damping

heady spear
royal tartan
#

right there

heady spear
#

been programming for the last 10 hrs.. maybe i need a break šŸ˜„

#

Thanks for the help!

hidden beacon
#

hey guys I've been beating my head against a Cinemachine issue for a couple of days and am close to just writing my own camera movement but if I'm just missing an option would like to not. Here's a video of what's happening:

Basically, I have 3 cameras for each posture my character can be in. I have them parented under an empty 3d object together, and they have 2 different follow targets they follow. However, when the cameras are inactive they are not updating their rotation--when I swap postures, you see my camera flicks around to a completely different X rotation. It is saving a version of my follow target for each camera even when the follow target is shared. How can I fix this?

I've also attached screenshots of my camera settings and transition code. Thank you for any assistance.

#

I have tried parenting them together, parenting them with their follow targets, using Inherit Position, using all 3 Standby Update methods, and the behavior is the same no matter what I change in those regards

late basin
split flicker
#

I am finding it extremely hard to blend between 2 CM cameras in the timeline . Unity 6 seemed to have changed the way the timeline works

late basin
hidden beacon
steady estuary
#

I’m curious about Cinemachine’s design. Blend hints are specific to the transition between cameras. This doesn’t sound like a camera property, but rather a blend or transition property. If I have this right, why are they defined on the camera? What’s the right way to manage different blend hints for Camera A to B vs Camera A to C?

late basin
steady estuary
ivory wraith
#

It would be very cool if you could add that hint information in the BlendOverride callback

#

I discovered that recently. Very useful.

queen relic
royal tartan
queen relic
vernal wraith
#

Hi guys i'm currently using the Cinemachine Confiner 2D but the first time i move my 2D Character the Confiner 2D seems to grow a little bit on the Y axis but i don't understand why, then it stops grow and works as expected.

vernal wraith
#

Ok I found the problem, I'm moving the 2D Character on the Z Axis

neon forge
#

Hello there everybody, anyone knows if you can use smoothing time and min occlusion time with third person follow cinemachine (3.1.3)

frosty prism
#

Does cinemachine support splitscreen? I need 2 cinemachine Cameras to be live at the same time

steady estuary
frosty prism
fair tiger
late basin
slow niche
# late basin Have you seen this tutorial? https://youtu.be/537B1kJp9YQ?si=m2a8UtSroquf1oOT

Hey gregoryl, I'm working on this now but I can't seem to get the exact behaviour following this tutorial. When I rotate the camera using my mouse, the player gameobject rotates and follows exactly where the camera is looking at as well. In the video tutorial, the camera rotates while the character object does not. This is the part of the tutorial where it is instructing the player object to rotate which doesn't seem to be working exactly in my own project

#

this is the part of the code that's making my player object rotate with the camera. I guess I could remove it but that will mean I will be implementing it differently from the tutorial hence I think I'm making a mistake elsewhere that's making this code run at the wrong timing (It's suppose to run only when I right-click the mouse)

#

Oh hang on I can't even remove it, if I do, the camera no longer rotates. I'm guessing I should be placing it on the child, but that again goes against the tutorial since this code is on the player game object not the child hence that rotation is meant for the player

late basin
slow niche
#

I'm using this instead of whatever was in the tutorial

#

But that cannot be as well, since the tutorial didn't have a check for that 2 lines *OH wait i see the "return"

late basin
#

When you run it, does it ever enter into the conditional? Put a breakpoint on the "return" at line 193. Do you hit it when the payer isn't moving?

slow niche
#

It seems as though that last 2 line i've commented out is meant for either:

  1. When the player is moving
  2. When the player is right clicking the mouse correct?
slow niche
#

So I guess i made a mistake there

late basin
slow niche
#

I should track player's velocity?

late basin
slow niche
#

Oh yes the move input

slow niche
slow niche
late basin
#

Take a look at the ThirdPersonWithAimMode sample scene. Is that what you want?

slow niche
late basin
slow niche
late basin
slow niche
#

Also I'm moving the player via rigidbody and netcode for gameobjects would it require alot of rework?

#

Actually which are the components which I've to touch on? SimplePlayerController and SimplePlayerAimController? What about AimCameraRig?

#

Hold on, actually is AimCameraRig all I need?

late basin
slow niche
#

The one in the sample scene seems to be basically a "Free Look Camera" and an "AimCamera" though it seems that the sample is kindda troublesome as I'd have to implement the code

slow niche
#

Are there any cons not to go with aimcamerarig instead of the one in the sample scene?

slow niche
late basin
slow niche
#

AimCameraRig.cs

#

It seems to be a unity sample code

late basin
#

oh I see. That's part of the camera setup, it's not part of the character controller. Let's deal with the character controller first. You can use any camera setup you like to choose between multiple CM cameras. AimCameraRig is just an example of one way to do it - which you can use if you like, but you don't have to.

slow niche
#

Because in the ThirdPersonWithAimMode sample scene, the camera rotates around the character via the mouse, exactly like the Free Look Camera

#

So I'm not really understanding why they went with a sample code implementation when they can use the Free Look Camera, unless there is some difference I'm missing out

#

Or is it so that the Input and movement of the player doesn't have to be 2 seperate thing?

late basin
late basin
# slow niche Yes aiming matters

Then you should go with the ThirdPerson approach. Notice in the sample how the aim is precise - even with hand-held camera noise (it's subtle, but it's there). Notice how aim is preserved when you switch camera modes. That's really hard to do without the ThirdPerson paradigm.

#

Notice also how when you fire a shot it always goes exactly where you're aiming. To implement that, there are several things that need to work in tandem. Study the sample in order to understand it.

#

@slow niche I am here if you have questions

slow niche
# late basin <@1254766848516423686> I am here if you have questions

Do you mind elaborating on the steps I should take before that? I'd like to know the following:

  1. As I'm using my own Player components and finite states, I'm assuming I need to copy the code from the sample scene
  2. Are you able to recall which exact components I should be copying from? I know the ThirdPersonAimController is one, what other components are besides this am I suppose to copy from?
late basin
slow niche
late basin
#

Yes. And don't forget Post-update

slow niche
#

^ I see the PreUpdate?.Invoke() in the ThirdPersonPlayerController so basically I get the ThirdPersonAimController to assign the action to my own Player script and have my player script run PreUpdate?.Invoke in the update loop

late basin
slow niche
late basin
digital venture
#

Hi guys. I want to make a 3D Platformer Camera, and the Orbit Follow with Lazy Follow active is giving quite a nice result. Everytime the character moves perpendicular to the camera the camera stays behind and rotates. But when i orbit the camera around with Input at the same time, the rotation of the Lazy and the rotation of the input start to fight each other, resulting in inconsistent rotation speed. Is there a way to suppress the Lazy Effect when Input happens?

late basin
digital venture
# late basin Can you show a video of the problem?

Basically, what happens is, i run perpendicular, and the Lazy Effect wants to rotate the camera to keep the target in view. As soon as the camera is starting to orbit due to input, these two rotations add up or slow down one another. And i want the Lazy effect simply not happening for as long the camera orbits due to input (and at best, a short timespan after).

late basin
digital venture
late basin
#

Looking again, I'm wondering what the problem is. If you orbit the player while it's moving, wouldn't you expect exactly what's happening? What ought to happen instead?

digital venture
#

thats what i try to achieve

#

so that the user never fights the rotation from the Lazy Follow

late basin
digital venture
late basin
sterile lynx
#

I'm experiencing jitter / stuttering when trying to use cinemachine follow target, what is the best practice to mitigate this?

#

So my transform can move in two different ways, first way is through rigidbody forces in realtime, the second way is through update in replay mode

#

my rigidbody is set to interpolate, and I tried setting update method on cinemachine brain to late update

late basin
sterile lynx
#

These don't happen at the same time

#

I'm seeing jitter in both modes though. The only way I can get rid of it, is if I set the rigidbody to not interpolate and set the cinemachine brain to smart update

#

turning rigidbody interpolation back on in smart update reintroduces the jitter

#

I can't figure out how to get rid of jitter in reply mode at all

#

It seems I need interpolation on for my rigidbody though for other things. For example, displaying the velocity freaks out when it is off

#

nvm scratch that last part, was due to another issue

late basin
#

SmartUpdate will monitor the target's transform to see whether it's being modified in Update or FixedUpdate. If the transform changes during FixedUpdate only, then the camera will update also in FixedUpdate. In any other circumstances the camera will choose LateUpdate. You can tell which one it chooses by entering playmode and looking at the CM Camera inspector. It displays the update mode to the right of the Solo button. What gets displayed there, both in RB mode and Replay mode?

sterile lynx
#

So I can leave interpolate off and RB mode works fine. Just need to figure out how to get rid of jitter in replay mode now

late basin
#

Explain what is being recorded and how it's being played back

sterile lynx
# late basin Explain what is being recorded and how it's being played back

Oh boy, it is a custom replay system I wrote. I can share the code if that is easier.

I essentially record the transform's position and rotation at a set recording fps (currently have it set to 10), then in playback I interpolate between those recorded frames in update at the beginning of the frame

#

The motion is smooth in playback if I watch it from an external camera, like the scene view

late basin
#

I don't need to see the code. Are you recording during fixed update frames?

sterile lynx
late basin
#

You need to record in FixedUpdate, because render (i.e. Update) frames don't occur at regular time intervals. FixedUpdate frames do. So very likely there is jitter in your playback, and no camera can correct for that (unless you attach the camera rigidly to the object - but then the background will jitter)

sterile lynx
# late basin You need to record in FixedUpdate, because render (i.e. Update) frames don't occ...

I think I'm accounting for this though, I only record if the time elapsed since last capture frame has exceeded the recording frame deltaTime. And I also record the time of the recorded frame into it's data.

if (_currentReplayFrame == -1)
{
    _currentReplayFrame = 0;
    RecordFrame(0);
    _currentReplayFrame++;
}
else
{
    float recordingTime = (float)(Time.timeAsDouble - _recordingStartTime);
    if (recordingTime - _lastFrameTimeRecorded >= _recordingFrameDeltaTime)
    {
        RecordFrame(recordingTime);
        _currentReplayFrame++;
        _lastFrameTimeRecorded = recordingTime;
    }
}
#

I also don't see jitter in backround with fixed camera to the object, although that may be less noticeable

late basin
#

ok, so you are recording at uneven frame intervals. Can you prove that your interpolation code is working correctly at playback time? Indeed jitter in the background is way less noticeable, and you can often get away with it if all else fails.

sterile lynx
#

Would I also see jitter from a stationary camera looking at the object go through space? Because I don't

late basin
#

When the camera is tracking, then even the most subtle jitter becomes extremely visible

sterile lynx
#

For what it's worth here is the playback loop:

float replayTime = (float)(Time.timeAsDouble - _replayStartTime);

if (_currentReplayFrame == -1)
{
    _currentReplayFrame = 0;
    StartReplayFrame();
    _currentReplayFrame++;
    OnReplayNextFrame();
}
else
{
    while (_currentReplayFrame < _currentRecording.Frames.Count - 1 &&
            replayTime > _currentRecording.Frames[_currentReplayFrame].Time)
    {
        float nextFrameTime = _currentRecording.Frames[_currentReplayFrame].Time;
        if (replayTime > nextFrameTime)
        {
            _currentReplayFrame++;
            OnReplayNextFrame();
            _lastFrameTimeRecorded = nextFrameTime;
        }
    }
}

if (replayTime <= _currentRecording.Frames[_currentRecording.Frames.Count - 1].Time)
{
    foreach (var kvp in ReplayObject.ReplayObjects)
    {
        // calculate lerp value
        float prevFrameTime = _currentRecording.Frames[_currentReplayFrame - 1].Time;
        float nextFrameTime = _currentRecording.Frames[_currentReplayFrame].Time;

        float lerpRange = nextFrameTime - prevFrameTime;
        float timeElapsedSinceLastFrame = replayTime - prevFrameTime;

        float lerpVal = timeElapsedSinceLastFrame / lerpRange;

        kvp.Value.OnReplayUpdate(lerpVal);
    }
}
#

And inside replay transform:

private struct TransformData
{
    public Vector3 position;
    public Quaternion rotation;
    public Vector3 scale;
}

private TransformData currentTransformData;
private TransformData nextTransformData;

public override void OnRecordFrame(ref WriteableReplayFrame writeableReplayFrame)
{
    writeableReplayFrame.WriteVector3(transform.localPosition);
    writeableReplayFrame.WriteQuaternion(transform.localRotation);
    writeableReplayFrame.WriteVector3(transform.localScale);
}

public override void OnReplayNextFrame(ref ReadableReplayFrame readableReplayFrame)
{
    currentTransformData = nextTransformData;
    ReadData(ref readableReplayFrame, ref nextTransformData);
}


public override void OnReplayStartFrame(ref ReadableReplayFrame readableReplayFrame)
{
    ReadData(ref readableReplayFrame, ref currentTransformData);

    nextTransformData = currentTransformData;

    transform.SetLocalPositionAndRotation(currentTransformData.position,
                                            currentTransformData.rotation);
    transform.localScale = currentTransformData.scale;
}

public override void OnReplayUpdate(float lerpValue)
{
    transform.SetLocalPositionAndRotation(Vector3.Lerp(currentTransformData.position, nextTransformData.position, lerpValue),
                                          Quaternion.Slerp(currentTransformData.rotation, nextTransformData.rotation, lerpValue));

    transform.localScale = Vector3.Lerp(currentTransformData.scale, nextTransformData.scale, lerpValue);
}

private static void ReadData(ref ReadableReplayFrame readableReplayFrame, ref TransformData transformData)
{
    transformData.position = readableReplayFrame.ReadVector3();
    transformData.rotation = readableReplayFrame.ReadQuaternion();
    transformData.scale = readableReplayFrame.ReadVector3();
}
sterile lynx
#

@late basin Okay so I wrote a simple camera controller with interpolation on RB set to on, and it is smooth in RB mode, but it is also jittery in playback, so I think I might just need to record the camera's transform as well.

[SerializeField]
private Transform _targetTransform;

[SerializeField]
private ReplayValues _replayValues;

[SerializeField]
private Vector3 _offset;

[SerializeField]
private float speed = 1;

private bool _nextUpdateIsInstant = false;

private void Awake()
{
    _nextUpdateIsInstant = true;
}

private void LateUpdate()
{
    UpdateCamera();

    _nextUpdateIsInstant = false;
}

private void UpdateCamera()
{
    Quaternion targetRotation = _targetTransform.rotation;

    Vector3 targetPosition = _targetTransform.TransformPoint(_offset);

    if (!_nextUpdateIsInstant)
    {
        targetPosition = Vector3.MoveTowards(transform.position, targetPosition, speed * _replayValues.Velocity.magnitude * Time.deltaTime);
        targetRotation = Quaternion.RotateTowards(transform.rotation, targetRotation, speed * _replayValues.Velocity.magnitude * Time.deltaTime);
    }

    transform.SetPositionAndRotation(targetPosition, targetRotation);
}

public void HandleReplayStartAfterFirstFrame()
{
    _nextUpdateIsInstant = true;
}
late basin
sterile lynx
#

And thanks for your help btw, I appreciate it!

late basin
sterile lynx
# late basin It shouldn't jitter, unless you're breaking interpolation by moving the RB incor...

This is the only way I am moving the rigidbody

private void FixedUpdate()
{
    _rigidBody.AddForce(throttle * 100 * maxThrust * transform.forward);
    _rigidBody.AddTorque(pitchMultiplier * responseModifier * pitch * transform.right);
    _rigidBody.AddTorque(rollMultiplier * responseModifier * -roll * transform.forward);

    _rigidBody.AddTorque(yawMultiplier * responseModifier * yaw * transform.up);

    _rigidBody.AddForce(_rigidBody.linearVelocity.magnitude * lift * _rigidBody.transform.up);
}
#

I think the problem with my replay is that the recording framerate is just too low at 10 fps. I don't think there is enough data to properly interpolate the turns smoothly. So I'll just bump it up to 45. It is way smoother

late basin
late basin
sterile lynx
#

Okay I guess I can calculate from the rotation

sterile lynx
late basin
sterile lynx
sterile lynx
# late basin I'm a little spooked by you reading the transform. Try to do everything using t...

So changed it to this, but still have jitter with RB set to interpolate and CM brain set to late update.

private void FixedUpdate()
{
    Vector3 forward = _rigidBody.rotation * Vector3.forward;
    Vector3 up = _rigidBody.rotation * Vector3.up;
    Vector3 right = _rigidBody.rotation * Vector3.right;

    _rigidBody.AddForce(throttle * 100 * maxThrust * forward);
    _rigidBody.AddTorque(pitchMultiplier * responseModifier * pitch * right);
    _rigidBody.AddTorque(rollMultiplier * responseModifier * -roll * forward);

    _rigidBody.AddTorque(yawMultiplier * responseModifier * yaw * up);

    _rigidBody.AddForce(_rigidBody.linearVelocity.magnitude * lift * up);
}
#

And no jitter with that simple camera controller I wrote

late basin
sterile lynx
#

I don't believe I'm modifying the transform anywhere else but let me double check. Setting it to smart, causes jitter as well and reports late update

#

Yeah not modifying it anywhere else

late basin
#

Maybe you should show me the jitter

sterile lynx
#

Okay hold on

late basin
#

Can you show me the CinemachineCamera inspector?

sterile lynx
late basin
#

This is with RB motion?

sterile lynx
#

Yes with interpolate on

late basin
#

what is the physics timestep?

sterile lynx
late basin
#

turn off the vcam damping settings one by one. does the jitter disappear?

sterile lynx
late basin
#

how stable is the framerate?

#

also: is that the sort of jitter you're seeing in replay?

sterile lynx
late basin
#

What happens if you set the z position damping to 0?

sterile lynx
#

well actually about the same jitter with replay.

#

let me try

#

still jitter

sterile lynx
#

so it is definitely the position that is jittering

late basin
#

what kind of worldspace distances are we talking about?

#

I mean, how fast is this thing moving, and how far from the origin is it?

sterile lynx
#

My object's position is less than 10,000 in all axes

#

It's moving fast, like 1,000 km/h

late basin
#

we might just be tripping over precision 😦

sterile lynx
#

so like 277 m/s

late basin
#

Would you be willing to send me the project?

sterile lynx
#

Not this exact one because I'm at work. But I can make a similar one later and replicate when I get home and send that.

late basin
#

That would be helpful. I don't need all the record/playback stuff, just that test shape flying around in RB mode

#

but if you want to send it all that's fine too

indigo quarry
#

Hiii everyone,im new to cinemachine and unity

#

Can anyone guide me

indigo quarry
royal tartan
#

no aim behavior

indigo quarry
#

ive not used cinemachine yet

#

idk how to use it

royal tartan
sterile lynx
sterile lynx
#

The controls are bound to controller btw

slow niche
#

anyway after implementing PreUpdate, the camera doesn't react to the mouse input. I'm trying to find the area where the mouse input is processed in the sample code

#

I think i found the function ^, but I can't "Find References" where the sample bot is executing this function. I'm guessing this is being assigned in the inspector

slow niche
#

This is basically how I'm moving my character. I apply a force in the direction of the given keyboard input. But currently with the sample setup, everytime I move and change directions, the camera keeps following behind the player as it rotates. This then causes quite a weird "spinning effect" if i continue holding down that new direction keyboard input e.g left or right. It'll endlessly spin the character continuously. Do you think my setup is compatible with the sample thirdpersonaimcontroller code?

slow niche
#

I think firstly i need to know how is this component which is in the player object ^, linked to the SimplePlayerAimController* component.

#

Because SimplePlayerAimController is getting updated by the mouse input as seen here:

#

But when I "Find References" I can't seem to find any that is taking in mouse input.. So my guess is the SetLookDirection function in SimplePlayerAimController that is taking in the mouse input, though upon "Finding References" for that function, there are 0 results

late basin
tired trout
#

Hello
How do developers manage the Audio Listener when using Timeline and Cinemachine? Normally, the player has an Audio Listener, but during a cinematic where different virtual cameras are active, how do you make sure the audio sounds correct based on the current camera's position?

Some Context:

  • Using Timeline & CinemachineBrain to switch cameras.
  • The player’s Audio Listener is normally active, but it may not be positioned correctly during cutscenes.
  • I want the audio to sound like it’s coming from the active Cinemachine camera
sterile lynx
tired trout
sterile lynx
#

Doesn't cinemachine just move the actual camera though? The cinemachine cameras are "virtual"

#

so it blends between the virtual player camera and cutscene virtual camera

tired trout
sterile lynx
#

but it always moves the same real camera

sterile lynx
#

But regardless, just have the AudioListener on the actual camera, that will always have the audio come from where it is currently rendering

slow niche
late basin
late basin
late basin
late basin
# slow niche This is basically how I'm moving my character. I apply a force in the direction ...

You're not giving enough details. The spinning effect might have something to do with the reference frame of the input. Are directions relative to the camera or relative to player forward? SimplePlayerController gives options for this sort of thing. You can try playing with those a little to understand better wat they do. Incidentally, your code that goes rb.transform.whatever = ... raises a red flag. You're not using the RB properly - you should never touch its transform directly.

late basin
#

@slow niche Writing a character controller is tricky, especially in you're also using RigidBodies and have the aiming requirements that you do. This is a good exercise, especially if you're not an experienced coder. Don't expect it to be quick.

slow niche
# late basin You're not giving enough details. The spinning effect might have something to d...

"Incidentally, your code that goes rb.transform.whatever = ... raises a red flag. You're not using the RB properly - you should never touch its transform directly."

Thanks, But I'm only using it for rotation? Is that not recommended? I've seen tutorials using it. If that's not the case, may i know what's the proper way to have the character look in a specific direction without using transform.rotation?

slow niche
slow niche
# late basin <@1254766848516423686> Writing a character controller is tricky, especially in y...

No, you've misunderstood. My custom character controller with the code example I've provided which you've stated isn't recommended, is working to the desired effect with the free look camera. So I've settled my custom character controller which is done via a custom abstract finite state machine, not just one script containing all the character behaviors as seen in the sample scene.. (except for the part where you've stated it is not recommened to use transform."whatever", which I'd gladly appreciate if you let me know what is a better approach to rotate the character without rb.transform.LookAt/Rotation or "whatever".

What I need to do now is to modify my custom character controller to work with the sample camera setup.

The issue here is as soon as I switch to the camera setup in the unity Sample ThirdPersonAim scene, that camera setup behaves in the spinning manner described in my earlier post.

Just in case, but also don't misunderstand the decision of wanting to use my own playercontroller instead of simply using the one in the sample scene. I'm using my own because I'm handling each behavior, e.g moving, attacking, flinch etc in seperate finitestates. Hence imo think it would be best if I roll my own solution to have different states instead of just one playercontroller script handling every behavior (There'll be too many conditional statements and will get messy real quick). I've already got the desired effect in combination with the freelook camera, until I came to the separate aiming portion and was looking for the best way to implement this hence asking here to familiarize with the sample code before I can actually integrate things in...

late basin
# slow niche No, you've misunderstood. My custom character controller with the code example I...

By all means use your custom controller. The issue at hand is how to add a child object that drives both player aim and camera angle. The SimplePlayerAimController takes care of reading user input and applying it to the child object, but it needs to work together with the player controller (which can itself rotate) in order to manage the combined rotations. That's what the pre-update and post-update hooks are for. You need to understand what those do.

To interact with Rigidbodies, you need to use the API inside the Rigidbody, and it needs to be done from FixedUpdate. Use things like Rigidbody.position and Rigidbody.rotation. Accessing the transform via Rigidbody.transform is against the rules. See the API here: https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Rigidbody.html

Looking at the code in SimplePlayerAimController, I see that it's not only modifying its own transform, it wants to modify its parent's transform as well. Clearly this won't work out of the box if the parent is controlled by a Rigidbody, so at best this code can only serve as a strategic guide for one potential way to implement this.

You can convert the code to use the Rigidbody API, but then you have to call it from FixedUpdate. In fact, you can just move all the code right into the FixedUpdate of your controller and not bother with this script or the hooks at all (I think that's what the video code was doing - which is fine).

One thing: user input should be read during Update, not FixedUpdate, so the normal strategy is to read it in Update and store it for subsequent use in FixedUpdate.

sterile lynx
#

When cinemachine is running in FixedUpdate loop does it interpolate transform values between update calls?

sterile lynx
#

thanks!

sterile lynx
#

Okay so I want to update the camera in FixedUpdate and interpolate the positions in Update. Is this achievable with cinemachine? If not, I guess I'll just have to write a custom camera controller.

subtle ice
sterile lynx
#

Essentially trying to solve this and it seems like it might be a limitation of cinemachine. I want the render loop to not feel like 50 fps, but also have a smooth follow camera when moving object with rigidbody

feral shadow
#

so I set my cinemachine camera to follow the cow, but it doesn't seem to capture it in some positions, what could be the problem?

feral shadow
#

nvm got it to work stonks

finite cove
#

How would I go about changing a value like Dutch or Zoom in the CinemachineRecomposer through code?

finite cove
royal tartan
ivory wraith
#

it's trying to be too clever

#

just list the damn methods!

#

i much prefer the main documentation site

dull cradle
#

private void Rotate()
{
if (isShooting)
{
Vector2 input = playerInput.UI.Point.ReadValue<Vector2>();
Camera activeCamera = Camera.main;

    // Convert screen position to world position
    Vector3 mouseWorldPos = activeCamera.ScreenToWorldPoint(new Vector3(input.x, input.y, activeCamera.transform.position.y - transform.position.y));

    // Lock Y position
    mouseWorldPos.y = transform.position.y;

    // Rotate towards the target
    Vector3 direction = (mouseWorldPos - transform.position).normalized;
    direction.y = 0; // Keep rotation flat
    transform.forward = direction;
}

}
cs

could anyone help here? im using cinemachine and i got a mouseWorldPos checking for ScreenToWorldPoint, the moment i switch between cameras the mousePos goes to complete shit and gets fixed on the left side of the screen

marble yachtBOT
nova tulip
#

How can I modify certain variables of cinemachine in Unity 6? When I try to make a cinemachinefreelook variable it just doesn't let me saying it's deprecated

ivory wraith
#

Everything is done with an ordinary cinemachine camera

pliant onyx
#

What would be some settings to get a virtual camera to just pivot over the character and LookAt it without any rotation? Unless there's a way to add offset when using both Hard Lookat and Hard Lock To Target, I'm not seeing it

#

Alternatively I guess I could just use a position constraint

#

Ah, I think 3rd person follow with LookAt seems to work

royal tartan
late basin
tardy pelican
#

Hey yall, I've been playing around with cinemachine for a little bit and I implemented 3 noise profiles that the player transitions through:

  • Idle
  • Walk
  • Run

My question is, how do you seamlessly (or close to seamless) transition between these profiles? currently it's a bit jarring to clearly see the noise profiles change

Currently the noise changing is something like this within a script:

// updating noise on the camera depending on whether the player is idle, walking or running
private void UpdateNoise()
{
    if (noisePerlin == null) return;

    if (horizontalInput != 0 || verticalInput != 0)
    {
        noisePerlin.NoiseProfile = isRunning ? runNoise : walkNoise;
    }
    else
    {
        noisePerlin.NoiseProfile = idleNoise;
    }
}
ivory wraith
#

The first thing that comes to mind is writing your own cinemachine component

#

It'd do basically the same thing as CinemachineBasicMultiChannelPerlin, except it'd have multiple noise profiles to choose from, and would blend between them

tardy pelican
#

hmm hmm alright, never written my own components before (aside from the usual monobehavior scripts)

late basin
tardy pelican
#

ahh i should try that actually, would help me learn how to transition between the cameras

#

ok i'll give it a shot

late basin
tardy pelican
#

ok!

late basin
shadow reef
#

camera is stuck at 90 degrees how to fix

umbral raven
# shadow reef

The camera follows the active virtual camera values. Change that.

#

You probably need to go do some beginner tuts on CM

shadow reef
#

thanks

late basin
# shadow reef

If you're trying to look at the target, use Rotation Composer in Rotation Control, instead of Rotate With Follow Target

sterile lynx
# late basin Thanks, but I'm unable to load the Main scene without errors. Prefab is missing...

Sorry I'll try to fix that later.

I think I figured out the root of the jitter and it was a combination of inconsistent framerate, RigidBody interpolation, and the camera being updated in LateUpdate.

Now the simple "solution" (not good enough for me) is to just turn off RigidBody interpolation and move the camera in FixedUpdate as well. The major problem with this, is now the game appears like it is running at low framerate because the camera only moves each FixedUpdate.

The better solution is to actually interpolate the RigidBody between FixedUpdate calls ***and *** move the camera in FixedUpdate while also interpolating it between FixedUpdate calls. This allows for a smooth follow camera even at inconsistent framerates.

#

I couldn't figure out how to interpolate the cinemachine camera between fixed update calls

shadow reef
sterile lynx
#

Could an option be added to allow interpolation between fixed update calls when in fixed update mode?

errant shard
#

Pretty interesting that the jitter appears even with RB interpolation and LateUpdate vcam together
I'd have guessed that should take care of it

late basin
late basin
sterile lynx
sterile lynx
# errant shard Pretty interesting that the jitter appears even with RB interpolation and LateUp...

I just think interpolation at inconsistent framerates will appear jittery. Even viewing it from a static side camera there is jitter at inconsistent framerates, although harder to notice.

By moving the object and camera in fixed update and interpolating both of them, they essentially experience the jitter together. This gives the effect that the world jitters which is a lot harder to notice.

#

and makes the follow camera smooth no matter the framerate consistency.

sterile lynx
#

Or it could be that by moving the camera in late update with rigidbody interpolation on, the follow camera is doing calculations on interpolated data which can cause weirdness at inconsistent framerates. Whereas moving the camera in fixed update it does the calculations on non-interpolated data and then interpolation is applied to both the object and the camera afterwards

tardy pelican
#

Hey yall, so tried doing the 3 different states with the first person camera, however it seems the other cameras are not updating at the same speed the active camera is, so when the game transitions to the other camera, you get this huge disorienting jitter

I tried looking at the RoadieRun sample, but could not figure out what was causing this

late basin
tardy pelican
#

That's disabled, same effect happens when enabled

#

what I mean with not updating at the same speed, is from what I can see the inactive cameras are not rotating like the main camera is, or at least not at the same "sensitivity"?

late basin
tardy pelican
#

Swapping to update always didn't help either, though i do see the difference between each update method

#

Could it be the wrong approach for a first person camera? Doing hard lock to target + pan tilt for the camera controlling

late basin
#

Although maybe a better approach would be to do it exactly like a 3rdPerson cam, except with the offsets set to put the camera in the head instead of behind. That way there is only one thing being controlled by input, and multiple cameras responding to it. In the RoadieRun sample scene, try adjusting the offsets in the cameras to convert them to 1stPerson

tardy pelican
#

Alrighty, i'll give it a shot

inland hollow
#

Hi, i'm using cinemachine's clear shot.
I have the problem you see in the photo, the cam doesn't change when the pg is out of vision.
I've put the photo of the setting.
Does anyone knows why is it happening?

Cinemachine 3 and unity 6

late basin
#

Enable Shot Quality Evaluation

inland hollow
#

THANK YOU

#

What option should i use? :P

#

Like what should i consider to setup them sorry

late basin
inland hollow
#

Thank you ^^

late basin
inland hollow
#

Yeah, i noticed that it even takes the one under ground

#

There is the collider in the ground, what should i do?

#

Oh yeah noticed the collide against thing

#

Yeah it still has bugs

storm abyss
#

First picture is my follow camera. Second is the camera I want to switch to by simply changing its priority. And third is my MainCamera. Switching Priorities does not seem to have any affect. I'm still on my PlayerFollowCamera.

#

What should I do here?

#

Also. If I disable my PlayerFollowCamera. It switches to my Npc Camera just fine. But I'm trying to understand why changing priorities does not work.

#

Also something weird I just noticed is that. My main camera is overridden with Npc camera as it says on the inspector. But I have to manually enable and disable my main camera for prioritiy changes to work.

late basin
late basin
storm abyss
#

Sure

late basin
storm abyss
#

No I have one main camera and a single cmbrain on it

#

Both of the cameras are on the default layer

#

Hmm wait.

#

I dont know why there is a camera in here

late basin
storm abyss
#

It says post process layer depends on it

late basin
#

get rid of that too (but do it first

#

or move those things to your real main camera

storm abyss
#

I did get rid of them

#

Anything else you want me to look for?

late basin
#

no other Camera objects? Should work now

storm abyss
#

All right I will check now and let you know thanks.

late basin
#

Also: you should set the LookAt to null in your PlayerFollowCam. Get rid of that warning message

storm abyss
#

Oh. Thanks a lot. It works now. Was it because of the camera component I had?

late basin
#

probably

storm abyss
#

Nice. Thanks again!

hollow current
#

Hey guys, how do I set Cinemachine Freelook's camera to feel natural?

I've been using X and Y Axis controls as Max Speed value, and it didn't work very well. Now I changed to Input Value Gain, and it's much better, but the speed of Y and X are different, even if I set the same value (I guess widescreen resoution?)

Is this how you guys set up the 3rd person look camera?

How do devs match the FOV/Resolution in mouse sensitivty, so that Y and X match? What's industry standard for this?
Is it just 16 by 9, so 9 parts for Y and 16 for X? So that X must be 1.7 times more? (Edit, nope, no way)

Also, I have to set the speed with Input Value Gain to 0.01 for Y and 0.4 for X for it to not be SUPER FAST. I feel like I'm doing something wrong..

#

Is this right place to ask for questions?

#

These are my settings
And this is how I got it to feel kinda ok, but then again, I feel like I'm doing something wrong, because I shuoldn't have to set 0.008 on Y and 0.4 on X (Got roughly on the same level by feel). This brings up questions like, how do I set mouse sensitivity (later in settings) as 1x multiplier, or so on.

How are these things done usually? The mouse settings and sensitivity?

#

There must be a nicer way to do this, which I'm missing, and I couldn't find a tutorial or guide on this.
People tend to do "max speed", which works very sluggishly, because that's not how camera/mouse works. It should correspond to my mouse movements 1:1, and if I move my mouse twice the distance, it should orbit exactly twice (or more, depending on the sensitivity settintgs).

hollow current
#

Another issue I have is that whatever I set here (to save and be the starting camera direction) it changes to 0, so the start camera direction may drift.
What am I doing wrong?

late basin
# hollow current I found a forum thread here https://discussions.unity.com/t/free-look-camera-and...

In CM 2.x, FreeLook X axis range is -180...180 and Y axis range is 0..1, hence the asymmetry of the scaling factors. There is no such thing as 1:1 out of the box, because it's dependent on how you've configured your orbits, and on the display resolution. You'll have to use trial and error to find values that feel right, and very probably offer tuning settings to your users.

In CM3, this is different, and axis ranges are in degrees for both X and Y. Is there a reason why you're using CM2 and not CM3?

I've also noticed that you have the Input package installed but are still using legacy input for your FreeLook. Why is this? Which input system do you intend to support?

late basin
# hollow current Another issue I have is that whatever I set here (to save and be the starting ca...

The X axis value keeps resetting to 0 because you're using the "Simple Follow" binding mode, which interprets the axes in Camera space. Since 0 in this mode means "look in the direction of camera forward", you will always see 0 here at the end of the frame. If some other value gets put there at the beginning of the frame, then CM will apply that offset during the frame and change the camera direction, after which 0 will be put there once again. If this is not the behaviour you want, try changing the Binding Mode to something else, perhaps "World Space".

hollow current
#

Also, please, consider that I'm a newbie, so my ways of doing things may not quite be optimal. It's just what I found that works for me and I thought that i'll be using those methods unless there's a need to switch

late basin
hollow current
late basin
hollow current
#

I see

late basin
# hollow current Reason I've been using Simple follow with Wolrd Up is because I'm making a ball ...

I can't recommend specific camera settings without understanding the nature of the camera behaviour you want. If you'd like to stick with Simple Follow that's fine, but it just means that setting the initial position of the camera will not be fully controllable from the inspector, but will depend on where your camera in instantiated in the scene. You can try calling FreeLook.ForceCameraPosition to manually place the camera at the start of the scene.

hollow current
#

In regards to this:
"In CM 2.x, FreeLook X axis range is -180...180 and Y axis range is 0..1, hence the asymmetry of the scaling factors. There is no such thing as 1:1 out of the box, because it's dependent on how you've configured your orbits, and on the display resolution. You'll have to use trial and error to find values that feel right, and very probably offer tuning settings to your users.
"

Do you have an idea how I could calculate it to be at least 1:1 Y and X axis? If I understood correctly, there's certain ratio of Y and X axis. And there's a way to at least get that ratio 1:1.

late basin
hollow current
#

Making the values symmetric would at least give me control over Whole sensitivity universally. That's the main problem for me.
Then, I could increase the overall sensitivity by x value from the code for both X and Y axis..

#

My logic tells me that X axis' input gain value must be 2x times of Y axis, because one is 180 degrees, and other is 360, but that seems wrong.
By feel, I found that 0.1 and 0.5 are close. But I can't explain why.

late basin
hollow current
#

Hm.
is there a way to find that ratio exactly?

#

Unfortunately, I don't have enough deep understanding of why is there a difference in the first place

late basin
#

Of course it's possible to compute the angles from the orbits (and in the end that's what CM3 is doing under the hood) but it seems to be that the point is for it to feel right, and you can determine the appropriate ratio for that by trial and error.

hollow current
#

Oh btw, Cinemachine 3 isn't available for upgrade. I think that's because I'm on uhnity 2022.3.0f1?

hollow current
#

Also, last thing, Would you recommend an in-depth cinemachine tutorial?
Most I've seen go over things quite lightly.

late basin
hollow current
#

I don't, because, well, there wasn't really (or isn't) a reason to upgrade, and then I'd be even farther from most tutorials/guides.

#

And I'm also worried something may break

#

Well, thank you for the help sir, have a nice day šŸ™‚

late basin
# hollow current Also, last thing, Would you recommend an in-depth cinemachine tutorial? Most I'v...

I wish I could, but afaik there isn't really anything comprehensive out there. I guess it depends on what you need to know how to do. Git-amend does nice work, imo https://www.youtube.com/channel/UCMAU6mx40NWsQuYmxAzPcHA/videos

#

He also has a discord server

hollow current
#

haha

#

It's helpful too, sometimes..

#

šŸ˜„

brisk skiff
#

I wish documentation was more accessible to the lamen. Or that there were more cohesive tutorials. My biggest issue with unity in general, for so many things there's basically 0 information anywhere besides surface level stuff (which is usually out of date).

#

Especially compared to unreal, blender, maya, hell even Zbrush, the lack of intuitive ui/tutorials is abysmal even paid tutorials theres almost none by comparison

#

But I know thats just me whining. It's just so frustrating to attempt to teach yourself something when there's so many obstacles

#

Btw, if anyone knows of a good unity overview tutorial thats comprehensive please share lol.

royal tartan
#

Have you looked at !learn

marble yachtBOT
#

:teacher: Unity Learn ↗

Over 750 hours of free live and on-demand learning content for all levels of experience!

brisk skiff
#

Thats absolutely my issue, I'm not realistically able to learn C#

#

I've tried for years with python to no avail.

#

I've made a carreer as a 3D artist, no coding has been required. Even for creating shaders, there's usually a shader graph editor

#

Don't think coding is a barrier I'll ever get over tbh, and I think that's okay

royal tartan
brisk skiff
#

Hahaha thats super fair. I will no longer be surprised. (Although I'll probably still whine lol)

#

Visual scripting, is that like unreal engine's blueprint system? Thats probably something I could do

#

Unitys animator kinda feels like a visual scripting interface

nova tulip
#

I've got myself a cinemachine freelook camera, and I've made myself a bunch of code that changes the camera's radius whenever it collides against something. It works, but changing the radius of the orbital camera changes the position and rotation of the camera, which I don't want. How do I ensure the camera doesn't change orientations with its radius?

royal tartan
nova tulip
#

I don't want for the camera's position and rotation to change, just the position alone

#

I want for the camera not to rotate when the radius changes

royal tartan
#

The rotation will depend on what its look target is

late basin
steady arch
#

Why does the Game view recording using Cinemachine is breaking like this?

#

@everyone

#

Also if someone can suggest a good way to record this player controller go around the whole environment

do I need to set up cinemachine, hit play and then go around the whole scene ?

royal tartan
steady arch
royal tartan
#

Are you using Unity Recorder?

steady arch
#

Cinemachine?

#

yes

#

I am using movie option, then

#

I hit play here, the game mode starts, I take my character and walk using 3rd person controller

royal tartan
#

Alright well I doubt it has anything to do with Cinemachine

#

Seems to be some kind of encoding issue

steady arch
#

should I change the encoder then?

deft nova
#

try different kinds of encoders if not then changing the codec will surely fix the problem

stiff void
#

hi, i do not know if i should ask this question here but i am trying to make a parralex background but do not know what canvas size to use, my lens ortho size is 10 and my tiles in my game are 64 x 64

#

can anyone helo me

latent spear
#

Hey, i have a problem. So i have a third person multiplayer shooter similar to fortnite. And i want to make the aiming which i have done by having 2 cameras one with 50 FOV and one with 30FOV and i switch between using the priority parameter to simulate aiming. This works perfectly but the cameras get out of sync in some time. one camera gets on a slightly different position than the other. i think this is because when one camera is not the priority and is not active it doesnt deocclude so it gets out of sync. How do i fix this or how should i implement the feature? I also have the cameras not attached to the player but i have them in the scene by their own because the game is multiplayer

queen relic
#

hey everyone, i am trying to make a camera where it tries to keep a 2D plane-styled focus but still heavily accounts for the 3rd plane when fighters end up switching sides somehow due to major movement shifts the controls kinda orbit with the camera- it's just really hard to explain. first video is what i have and second is what i am aiming for.
https://cdn.discordapp.com/attachments/763497743976497222/1338238605281460255/Pcsx2-Qtx64-Avx2_2025-02-09_21-53-02-67.mp4?ex=67c41092&is=67c2bf12&hm=a3c86c8f61e0977af5e20ee104249781758fb71ba3626a69da1705d0e698312e&

steady arch
#

@royal tartan @deft nova Guys you were right, I changed the encoder, and it's breaking up anymore! Thanks both of you!

deft nova
#

Great to hear that!

broken cove
#

trying to make it so I can have the camera go forward if it runs into obstacles

#

if I turn the Rotation Composer off.... the camera just goes off spinning?

Can I not just use Cinemachine Deoccluder so the camera moves forward if it runs into obstacles? (Because the rotation kinda makes it bad on my current turning the camera system)

solar plinth
#

how can i limit, how far up and down i can look with a cinemachineCamera?

prisma vine
#

You guys probably get this often.. Maybe. But why is it that after entering play mode, the cinemachine camera starts elsewhere then slowly moves to the target position?

royal tartan
prisma vine
royal tartan
#

You should always have one normal Unity camera for the actual rendering with a CM brain on it. The CinemachineCameras are not actual cameras. They just position the actual camera.

prisma vine
#

That’s the login camera

royal tartan
#

anyway sounds l;ike yes you are transitioning from one camera to another

#

which means a transition will happen

prisma vine
royal tartan
#

if you want it to be an instant cut you can set it to do that instead of interpolating between them

prisma vine
pliant hinge
#

Hey, I'm setting up a character controller for outer space movement. I currently have a freelook camera and WASD movement that moves the player forward relative to the direction their camera is facing. This works fine but I also want the world up override to be the player so the player can spin around in the vacuum of space and land on planets without a sense of "up" and "down". With cinemachine though, when you update the world up override, the camera rotates with it which causes the player to rotates and then the world override. This leads to the player spinning when you try to move and turn the camera. Does anyone have any ideas on how to fix this?

royal tartan
#

Look into the more flexible third person options and don't be afraid to write some code yourself

late basin
late basin
latent spear
latent spear
late basin
latent spear
late basin
# queen relic hey everyone, i am trying to make a camera where it tries to keep a 2D plane-sty...

This is tricky. I don't think there are out-of-the-box components in CM that will implement it without some coding from you. I would approach it by creating a proxy GameObject to use as a target. Write a custom script to position the proxy between the two characters, and orient it so that its z points perpendicular to the line connecting the characters, along the plane, always in the direction away from the camera. Then, make your camera follow that object and be always behind it. That should do the job, I think.

latent spear
#

here is a video of the problem, i have the 2 cameras that are identical, have exactly the same values and target but one has lower fov, when i press the aim button the aimcamera becomes active but as you can see on the video the camera moves a little bit down when i aim.

#

@late basin

late basin
# latent spear here is a video of the problem, i have the 2 cameras that are identical, have ex...

The paradigm is wrong. You're telling both cameras, via the Rotation Composer, to look at the player. There is no logic to preserve camera rotation - there is only logic to tell the camera to position the player at such-and-such a point on the screen. Now you can, by trial-and-error, find the appropriate Composer settings that will in fact preserve the rotation for this specific pair of cameras, but I would not recommend that approach as it is not very robust.

late basin
latent spear
#

so should i make a camera rig with both cameras attached?

late basin
# latent spear so should i make a camera rig with both cameras attached?

In the sample scene, this is correctly set up. Study it carefully to understand how the aim tracking works. Notice that the camera aim point does not change when switching between cameras, and notice also how the aim is perfect - even though the aim camera has a little hand-held noise on it. Fire the bullet, and it correctly hits the target. There is logic to implement all this, it doesn't come for free.

late basin
latent spear
latent spear
late basin
# latent spear so how should i implement them?

Do it like in the sample. There is a "player aiming core" invisible object which is a child of the player. The controller doesn't move the camera, it rotates that object. You can just grab the code from the sample if you like. Both cameras are rigidly fixed to that aiming core object via the ThirdPersonFollow component. The ThirdPersonAim extension manages the aiming target, and gives the cameras knowledge of what they're aiming at (which the Fire behaviour can access).

#

@latent spear This tutorial is also helpful: https://youtu.be/537B1kJp9YQ?si=YSV-h0eVAhCdo5Hb

In this video, we’re going to look at how we can set up a third-person camera using the new Aiming Rig of Cinemachine 2.6, and how we can use Impulse Propagation and Blending to create additional gameplay functionality for our camera controller.

Download this project here!
https://on.unity.com/36nVNzt

Learn more about Cinemachine 2.6 here!
htt...

ā–¶ Play video
latent spear
# late basin

thanks for the detailed answer. i actually when i started making the game used the third person aim component for the camera but i didnt like the fact that i had to rotate a separate object to rotate the camera and also that i would have to make the constraints for looking up and down. So instead i used the orbital follow which seemed like a more easier choice. I will probably let it be like this and just have 1 camera and just change the lens fov by code but in later games i will probably use the aim component.

late basin
late basin
latent spear
queen relic
late basin
queen relic
#

because now it feels like the controls are inverted in certain positions

late basin
queen relic
late basin
queen relic
#

YES

#

Thank you for your help UnityChanwow

feral iris
#

Sorry if it's not the right place to ask questions but I'm struggling to figure out how cinemachine works šŸ˜…
I'm trying to make cinemachine work, but the camera doesn't move with my mouse :/ I watched a few tutorial about it, and I don't see what they did that I missed
Does anyone know what i'm doing wrong here ? ^^"

late basin
queen relic
jaunty seal
#

hey guys quick question. I'm trying to create a simple knockback visual effect on my cinemachine camera with impulses. I call the impulse like so (for now):

Vector3 velocity=((PlayerController.Instance.transform.forward).normalized*m_VisualKnockbackForce);
            GetComponent<CinemachineImpulseSource>()?
                .GenerateImpulseWithVelocity(velocity);

I see I am on the correct channel and the impulse listener responds, but its very weird. If I set the "knockback force" beyond a value like 10, the camera seems to just go off-map for a frame and instantly return, so you just see the default blue background for a moment.

I know the listener responds, because when I add the secondary noise, it's correctly called and works on the camera. But why does it not work when called with a custom velocity via code?

#

if I set the knockback (so the velocity scalar) to lower values, it seems to not do anything to the camera

#

and I ensured to apply it on finalize, but that changes nothing. I only have a script changin the follow offset on update, but even if i disable it it does not change the issue

reef path
#

Velocity Calculation: The way you're calculating the velocity might be contributing to the issue. If m_VisualKnockbackForce is too high, consider capping it or applying a damping factor to smooth out the impulse.

#

float clampedForce = Mathf.Clamp(m_VisualKnockbackForce, 0, 10); // Adjust the max value as needed
Vector3 velocity = (PlayerController.Instance.transform.forward.normalized * clampedForce);

jaunty seal
#

Thing is, If i set it to something below 10, theres simply no effect to the camera, if i set it to something above I just get a split-second blue background before instantly returning to the exact same position

reef path
jaunty seal
#

wdym by camera bounds, if you mean they are setup correctly then yeah, it works perfectly, except for impulses. I just want the camera to move in the opposite direction of the fired bullet a bit, and the game is set on a XY axis, so Z is ignored. Could it be just clipping through the tilemaps?

#

ok i got it, i laid the answer myself right here lmao

#

im using XY, but scaled velocity on the player.forward, which is always 0

jaunty seal
#

solution is to use player.transform.up as that is technically the forward looking direction from the POV of the camera

#

i make these mistakes so often in 2d projects lmao

reef path
jaunty seal
#

it catches me by surprise every time, I think, oh i need forward so .forward and then debug everything else except that, until I shamefully realise what it was

#

yeah probably a good idea, thanks anyway!

solar stream
#

whenever I blend between two cameras, I notice that the camera's rotation /position is not calculated during the transition (i.e. moving the mouse/RS has no effect on the camera's position)
this feels pretty clunky since I have two different cams for general movement and one for scoped in aiming, and not being able to move the view (even if its just for a little bit) is not great

#

is there any workaround to this?

steady estuary
solar stream
royal tartan
solar stream
#

that makes sense but unfortunately is not what happens in my scene

#

(this is me wiggling the mouse constantly)

#

(normally the transition isn't that long, I just made it longer for visualisation's sake, but it's still noticable in gameplay even if it's 0.15s)

royal tartan
patent hinge
#

i am using 2d camera in perspective projection, and i want to keep the camera angle on the ground level. except this makes the whole scene ride high up on display screen, and i dont want the camera to see underground. confiner doesnt help, because it changes the camera angle. what can i do?

#

i figured i can just displace everything accordingly in 3d space, but id like to avoid that

royal tartan
# patent hinge

I don't really understand the question. You're moving the camera down. That means it will see lower stuff.

#

just don't move the camera down

#

It's not clear to me exactly what effect you're trying to achieve here.

#

Also why perspective camera instead of ortho?

patent hinge
#

id like to keep my camera angle and not have half my scene cut off

royal tartan
#

I'm not sure what that means tbh

#

you said you don't want to change the angle

#

the angle is not changing

#

moving the camera down will naturally show more of the world lower down then

#

"I want to move the camera down but not see lower" šŸ¤”

patent hinge
#

that is what changing the angle is

royal tartan
#

then you have to change the angle

#

to point up

patent hinge
#

and i dont want that. i want to crop my display

royal tartan
#

you mean you want to zoom in?

#

or you want the bottom of the screen to be black or something?

patent hinge
#

no and no

#

i dont want the bottom part of the screen

royal tartan
#

you want to change the size of the window?

patent hinge
#

what i want

#

what i get

royal tartan
#

move the camera up

patent hinge
#

changes the angle. is on video

royal tartan
#

use framing transposer

#

not position composer

patent hinge
#

whats with that thing

#

i dont think it works for me

#

i think i did it in a different way, thanks anyways

plucky dragon
#

Please let there be an easy solution...
I have a local multiplayer with split screen, two cameras with a cinemashine brain, and two virtual cameras (following each player)
i want PlayerCam1 to use vcam1 and PlayerCam2 to use Vcam2...
on the Cinemashine brain theres a variable saying "live camera" wich looks like its showing the Vcam that the brain is accessing, but why cant i just manually edit that in the editor😭 what would be the easiest way to achieve that?

late basin
# patent hinge

PositionComposer is the replacement for FramingTransposer. Use it. It allows you to compose your shot (i.e. specify where on the screen you want your character to appear), but it will never rotate the camera. Confiner2D will work with it.

patent hinge
#

is position composer a component? if so, when i tried to add it i got "this component is redundant" notification

late basin
#

You can also look at the Split-screen sample that ships with CM

plucky dragon
late basin
#

You'll need 2 regular Unity cameras, each with a CinemachineBrain component on a different CM channel (let's call the channels A nd B). Then, you'll create 2 CinemachineCameras, one on channel A, the other on channel B. You can create more Cinemachine cameras if you want, allowinf the brain blend between them for complex camera action

plucky dragon
#

i feel like im using a wrong version or something, cause in the doc the cinemashine brain and camera have a different icon, for me its called cinemashine virtual cam and there is no Cinemashine channels on the cinemashine brain either

late basin
#

You're using CM2. Can you upgrade to CM3?

plucky dragon
#

in the package manager? ill have a look wait

late basin
plucky dragon
#

22.3

#

dang it is CM3 only for unity 6?

late basin
plucky dragon
late basin
#

gpt is a bit mixed up about the differences between versions

plucky dragon
#

anyways thanks a lot while im at it i might switch to unity 6 anyways just in case it matters for future stuff, im just a few days into the project so is fine

late basin
#

I think that's a good idea

plucky dragon
late basin
#

don't we all

plucky dragon
#

and im like, where is that button, and hes like: oh sorry it doesnt exist

plucky dragon
#

Oh, you didnt know about the tripple A online multiplayer button?

#

wich turns your game into a triple a onlinemultiplayer, removes any bugs, and overhauls all graphics and effects?

#

well thats a skill issue

late basin
#

yes, that button exists, but it's really hard to press and takes a long time to find

plucky dragon
#

for me if i wanna keep creative control i sometimes just use the: "remove all issues" or the "make my code clean" button

plucky dragon
late basin
#

darn right

#

if we made it easy to find, people would just ask for more

plucky dragon
#

lmao anyways ill get to transfer my game to the new version! thanks for the help and have a good night (probably your not in european timezone but whatever)

late basin
#

good luck

plucky dragon
plucky dragon
# late basin good luck

i just wanted to say that the new cinemashine is SO satifying😭 actually accessing things with composer.Damping.y instead of m_Ydamping is so staifying to me! makes it feel way more like a real unity Package

#

also all of the hidden interfaces on the cinemachineCam make it way easier to navigate

#

they where cooking on this update

slow niche
#

I'm trying to get my cameraFollowTarget (which is a child) to not inherit rotation from the parent (The player object), I've tried various ways but here's one where I unparent before rb.MoveRotation is called on the Player object and than re-parent right after rb.MoveRotation. This semi-works as there seems to be a "back and forth" phenomenon in rotation where the camFollowTarget rotates with the parent and than warps back to the original position after. And advice on this? It's currently running on the update loop.

        if (aimLookAt != null)
        {
            xAxis.Update(Time.deltaTime);
            yAxis.Update(Time.deltaTime);

            float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity;
            float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity;

            horizontalRotation += mouseX;
            verticalRotation -= mouseY;
            verticalRotation = Mathf.Clamp(verticalRotation, -70f, 70f); // Limit vertical look
            camFollowTarget.rotation = Quaternion.Euler(verticalRotation, horizontalRotation, 0f);

            camFollowTarget.SetParent(null);
            if (clientInputDirectionRelativeToCamera != Vector3.zero)
            {
                Debug.Log(clientInputDirectionRelativeToCamera);
                // Rotate player ONLY if movement input is present
                Quaternion targetRotation = Quaternion.LookRotation(clientInputDirectionRelativeToCamera, Vector3.up);
                rb.MoveRotation(targetRotation);
            }
            camFollowTarget.SetParent(transform);
            camFollowTarget.rotation = Quaternion.Euler(verticalRotation, horizontalRotation, 0f);
        }
royal tartan
#

Anyway if you don't want to inherit rotation, simply don't be a child object

#

Use a PositionConstraint to follow the object instead of having a parent child relationship

slow niche
royal tartan
#

The built in component

slow niche
#

Though now it seems like it is making it a little more troublesome than i hope

royal tartan
#

Just make it a child in the prefab and have it get detached

#

When it spawns

slow niche
#

Because when a player disconnects, NGO automatically destroys all network objects associated with it

#

So with that child detached, it may end up leftover in the scene when the player disconnects and all network associated objects associated with it are destroyed.

royal tartan
#

Except for the local player wouldn't you just destroy it immediately?

#

For local player - detach it
For everyone else - destroy it

#

On spawn

slow niche
#

Yup, only the local player would have to be destroyed manually

#

I guess this would be the easier less cumbersome way to do it. The one in the thirdpersonaim unity sample is a little too complexed to understand, the comments don't really elaborate much

royal tartan
#

Alternatively this object is not part of the player prefab and you spawn only one locally to target the local player only.

slow niche
broken cove
#

been trying to look at the Cinemachine 3.1+ sample scene of the ThirdPersonWithAimMode but I cant tell what script is telling the Cinemachine components which one to activate

#

not very many tutorials on how to use or make this from scratch either via the 3.1 changes 😭

royal tartan
broken cove
#

freelook as in it rotates around the camera
aim as in it always looks forward in front of player

royal tartan
#

Are you talking about two completely different Cinemachine cameras?

You're wondering how they switch between the two?

#

You can switch between Cinemachine cameras by setting their priority or just enabling/disabling them

broken cove
royal tartan
#

Just search the code for those things

#

priority or enabled

broken cove
#

ngl I dont even know which script is controlling it (theres a handful)... but I can confirm priority is not enabled lol

royal tartan
#

Wdym "priority is not enabled"?

broken cove
#

the bool is just not enabled at all

royal tartan
#

What's on the camera rig

broken cove
#

so its this but I feel like this code just overcomplicates it? unless there is a reason they just do it like this

#
 protected override CinemachineVirtualCameraBase ChooseCurrentCamera(Vector3 worldUp, float deltaTime)
 {
     var oldCam = (CinemachineVirtualCameraBase)LiveChild;
     var newCam = IsAiming ? AimCamera : FreeCamera;
     if (AimController != null && oldCam != newCam)
     {
         // Set the mode of the player aim controller.
         // We want the player rotation to be copuled to the camera when aiming, otherwise not.
         AimController.PlayerRotation = IsAiming
             ? SimplePlayerAimController.CouplingMode.Coupled 
             : SimplePlayerAimController.CouplingMode.Decoupled;
         AimController.RecenterPlayer();
     }
     return newCam;
 }
royal tartan
#

Yep that code is picking the camera to use. Look at where that's being called from to see what they're doing with it.

dark viper
#

Hi, I want to blend from the current VCam to a specific VCam in my Timeline. I currently achieve that by having a Clip that has no VCam defined to it and then transitioning to a Clip with the VCam I want. I'm getting a warning from the Timeline that "a virtual camera must be assigned". However it does exactly what I want it to and I don't know how else to achieve it haha

late basin
dark viper
#

OMG i have been looking for this thing for ages, how did I miss this šŸ˜„ It's exactly where I expected it to be but for some reason I didn't see it. Thanks a bunch!

late basin
#

You can use the same technique to have CM timeline tracks blend into and out from other CM timeline tracks. You can stack it as much as you like

nimble knoll
#

I'm getting irritated with Cinemachine. It refuses to work and every tutorial is using the old version of Cinemachine when Virtual Camera was still a thing.

A lot of people on the internet say that Cinemachine Camera = the same as Virtual Camera, but they don't have the same options.

Anyway. I've got a Main Camera, and I try to create a follow camera to follow my character around. I've got a Cinemachine Brain also. But it does NOT update the main camera and I cannot figure out why, while in the tutorials with the Virtual Camera, it works out of the box.

When I delete the main camera, it's telling me no camera's are there. Even if the cinemachine camera is in the scene.

Would love some input on what I'm doing wrong. Because I'm this close to binning my project and moving on to 2D because that sure as hell seems easier.

#

Okay, apparently I figured it out and I feel dumb. At the same time, Idk how else I would've figured it out. I figured it out purely on accent.

steady estuary
nimble knoll
steady estuary
#

Main Camera + Brain > always required. Then on separate game objects you create one or more Cinemachine Cameras.

nimble knoll
#

I was attaching it in the scene.

nimble knoll
# steady estuary Main Camera + Brain > always required. Then on separate game objects you create ...

Do you happen to know if Cinemachine supports a World of Warcraft style camera system? I've got it set up in my script that when I click left mouse button the camera moves without the character, right mouse button moves the character in a direction. And this seems to work, to a degree. But the camera only moves on it's own axis, and doesn't center the player object despite it tracking the player object.

teal nacelle
#

yo guys how do I add virtual camera

errant shard
errant shard
#

I recommend start reading from page one onward until it starts making more sense, only then jump into pages that seem more relevant to your case

#

Also, it has detailed example scenes you can import from package manager's "samples" tab

pliant onyx
#

Using position/rotation composer. How do I go about making the camera repositioning to be less abrupt when the player walks towards the camera?

#

I guess the behaviour I'm looking for is the camera should be repositioning more towards the back of the character instead of looking straight down

#

Just playing around with dampening and the other few properties and I do get some better results, but was wondering if theres some component or other settings I should be aware of

#

Ah, ok toying with deadzone and dampening seems to really smooth it out. Kinda. It fixes the problem of getting into that deadzone, but it can still happen and if it does then it becomes abrupt

ripe lodge
#

how can i make a cinemachine camera always rotate with the player? i want to make it so that its always looking at the back of the player's head

#

if i have rotation control set to "rotate with follow target", the camera rotates whenever the player rotates, but it doesnt rotate around each ring and looks away from the player

late basin
ripe lodge
#

but how do i make it so that movement inputs override mouse look inputs?

#

atm, it rotates with the player additively, so that when you move the mouse or press wasd manually, it adds the movement rotation to the current cam rotation

#

how can i make it so that you can look around with the camera with mouse inputs, but make it so that the cams pos gets reset when movement inputs are detected? similar to Detroit Become Human, if youre familiar with that movement system at all)

late basin
ripe lodge
# late basin I don't quite understand what you're asking. Take a look at the Sample scenes t...

none of the samples are quite what im looking for. i'll try to explain this a bit better with the vid attached. (sorry for the low quality, i had to compress this a lot for discord)

in the video, the player can move around with WASD and can look around with the mouse. when the player moves, the camera look direction changes and recenters itself to look in the same direction that the player is moving towards (0:12-0:24). i was not moving the camera manually at all towards the 2nd half of the video. Instead, the cam was recentering itself since it wasnt looking in the same direction as the player's movement direction.

late basin
ripe lodge
pliant onyx
#

Using both position and rotational composer, I'm looking for a behavior such that the virtual camera would calibrate its position/rotation towards the player's forward direction if the player exceeds a distance from the camera. It's like I want a mix of the follow/orbital follow? when the player is further away from the camera.

#

I can possibly think of ways to script that in, but was just wondering if I'm overlooking some settings here.

#

It seems like I want to use these composers for that deadzone logic, but otherwise have a more loose follow implementation

#

I'll try fooling around with a second virtual camera implementation and see if they helps.

haughty thorn
#

Hello!
I'm currently messing around with the Target Group camera. I want the camera to zoom in or out based on position of the players in my target group.
I currently have it so that my characters get spawned when I press a button on my controller, and when they get spawned, they are assigned to the target group.

Currently it works, but it is not entirely how I want it to look like, and I assume it is because I am missing something/misunderstanding something.
I want the camera to look down on my players from a diagonal topdown view. And then it should only rotate, not move based on the characters positions. But currently the camera seems very zoomed out. Is there perhaps something I am misunderstanding/not using correctly?
Or is this doing exactly what Ive set it to be, and should I use a different approach?

late basin
late basin
late basin
haughty thorn
#

Nah, the problem was that it was too zoomed out. But I think with some fidgeting I've got it how I want it now.

Unless you have a different way for me to regulate the zooming. Because changing the framing size showed the entire map, but then it was too zoomed out.

pliant onyx
# late basin If you want the camera to only rotate and not move, then you should remove the F...

I was playing around with it and it does have a similar behavior to the position composer, and some of the properties sound like it's what I need but still haven't found the behavior I'm looking for. Perhaps I need to fool around with it more, but I think the best way to describe what I'm searching for is a way for the camera to recenter the Look at target when the look ahead is far enough away on the positive y of the frame.
https://i.imgur.com/pkarFnz.png
Like here, I can determine that my player has traveled long enough that the look ahead is extended out past the frame, so this would be the trigger that tells the camera to reposition it self more to the back of the player character.

#

And such that the camera will try to get the character and look-ahead more towards the positive x in this screenshot

late basin
# pliant onyx I was playing around with it and it does have a similar behavior to the position...

There's no specific logic in CM to do what you describe based on screen positions. The closest I can think of is to use the Lazy Follow binding mode. This will sort of pull the camera along behind the player like a trailer, so that as the player moves forward, the camera will gradually recenter itself behind it.

I'm assuming that you're using RotationComposer + Follow or OrbitalFollow. Don't use the PositionComposer for this.

old wing
#

you can kinda recreate some position composer stuff in the Orbital Follow but scripting your follow point

tawdry mica
#

Hey guys, having a problem when switching scenes with cinemachine.
Having three scenes

1. Systems (Persistent with MainCamera and Cinemachine Brain)
2. MainMenu (3 Cinemachine Cameras)
3. Gameplay (1 Cinemachine Camera)

Starting with Systems and MainMenu, everything works fine and I can transition between all 3 Cams.
Loading Gameplay and unloading MainMenu

SceneManager.UnloadSceneAsync("MainMenu");
SceneManager.LoadSceneAsync("Room1", LoadSceneMode.Additive);

and loading back into MainMenu

SceneManager.UnloadSceneAsync("Room1");
SceneManager.LoadSceneAsync("MainMenu", LoadSceneMode.Additive);

I can't transition between the Cameras anymore.
GameObject with Main Camera / Cinemachine Brain stays persistent via DontDestroyOnLoad though.

tawdry mica
#

nevermind, timescale got me