#I hope u know how to do what ima bouta ask

1 messages · Page 1 of 1 (latest)

scarlet trellis
#

How can i change the weight of these in code

indigo quest
#

well you are not really showing enough to even know what that is. what component

scarlet trellis
#

there all useless

indigo quest
scarlet trellis
#

finally

#

thankyou

#

someone linked me a usefull doc

#

now how can i make the weight of cam1 go down while cam2 goes up according to my zoom

indigo quest
#

well that is just math to do that

#

just work within the 0 to 1 range

#

if give one a weight of 0.8f well the other is going to be 1f - 0.8f

scarlet trellis
#

ok wait thankyou

#

im having trouble

#

understanding how to set weight

#

what do i do with this

indigo quest
#

its a method you call on the CinemachineMixingCamera

#

mxingCamera.SetWeight(vcam1Reference, newWeight)

#

or via index
mxingCamera.SetWeight(0, newWeight)

scarlet trellis
#

ahh ok

#

thankyou

indigo quest
#

when the docs is showing you
public void SetWeight(CinemachineVirtualCameraBase vcam, float w)
that is just the signature of it, so you know what it returns and what types it takes as arguments

scarlet trellis
#

ahh ig that makes sense

indigo quest
#

well means nothing without see the code that caused the error, but think you need to learn the basics of how to get and work with components

scarlet trellis
#
using UnityEngine;
using Cinemachine;

public class CameraMerge : MonoBehaviour
{
    public float newWeight = 1f;
    public Component mxingCamera;
    public void SetWeight(CinemachineVirtualCameraBase vcam, float w)
    {

    }


    void Update()
    {
        mxingCamera = GetComponent<CinemachineMixingCamera>();
        mxingCamera.SetWeight(0, newWeight);
    }

}
indigo quest
#

and what type is mixingCamera supposed to be, and what type did you store it in?

scarlet trellis
#

component

#

right

#

or is it a gameobject

indigo quest
#

dont guess think about it

scarlet trellis
#

CinemachineMixingCamera

#

this

#

i got it

#

ohhh it works lets go

#

but now how do i set the weight for vcam2

indigo quest
#

same way you did for 1

scarlet trellis
#

creating another void for vcam2?

indigo quest
#

you dont need to create a void

#

the

    {

    }``` is doing nothing and should be deleted
scarlet trellis
#

oooh i got it

#
mxingCamera.SetWeight(0, newWeight);
        mxingCamera.SetWeight(1, newWeight2);```
#

ur a god

#

so im how do i make it so that the more zoomed in i am the more it adds to a number

#

but like smoothly

#

with smoothdamp