Home>
Originally in script
if (Input.GetMouseButton (ROTATE_BUTTON))
{
rotateCmaeraAngle ();
}
private void rotateCmaeraAngle ()
{
Vector3 angle = new Vector3 (
Input.GetAxis ("Mouse X") * rotate_speed,
Input.GetAxis ("Mouse Y") * rotate_speed,
0
);
transform.eulerAngles + = new Vector3 (angle.y, angle.x);
}
I used to move the camera with the mouse, and right-click to target the enemy and point the direction of the enemy.
To avoid penetration
Collider with CinemachineFreeLook
It became non-penetrating in
Axis Control is automatically attached, so you can move it just by moving the mouse.
It's inconvenient because you can't target!
What should I do in this case?
-
Answer # 1
Related articles
- c # - [unity] i was able to rotate horizontally and vertically during touch operations on the smartphone screen, but i want to m
- c # - i want to rotate the z axis 90 degrees with unity2d
- c # - i want one script to control multiple objects
- c # - i want to rotate the gyro sensor of the smartphone and the object of the smartphone on the scene in sync with unity
- c # - object duplication script in unity 2d
- c # - [unity] i want to uncheck firstpersoncontroller with a script
- c # - what are the inherited members in the unity script reference?
- c # - can't get variable of script attached to ui in another ui
- i can't understand part of charactercontrollermove in the script reference in unity c #
- c # - i want to inherit enum with another script
- c # - i can't attach a script in unity (beginner)
- c # - can't add picturebox to script from windowsform
- c # - i want to control the transition of animation with a script
- c # script cannot be opened by visual stadio in unity
- c # - i want to reference a variable in the script of the parent object
- c # how to rotate an array of object type with foreacf
- c # - [unity] can't play animation with script
- unable to attach c # script to object
- c # script is not reflected in unity
- c # - [unity] how to make a script that executes processing after a certain period of time
Related questions
- c # - [unity] i am changing the value of a public variable from another script, but the value seen from the script with that pub
- c # - i want to create a webar in unity
- c # - i want to run unity: transformtranslate using rigidbody
- c # - error "nullreferenceexception: object reference not set to an instance of an object"
- c # - create a new scene with a script
- c # - i made a unity oculus rift laser pointer, but it doesn't respond
- c # - compile error when importing oculus integration in unity 20194
- c # - vroid in unity
- i want to use addforce to move forward when i press the q key in a c # script
- c # - play sound effects using unity is trigger
Wouldn't it be better to use a normal Virtual Camera than FreeLook?
If Aim is set to "Do nothing", the target will not be noticed without permission, and it will not interfere with the questioner's own camera control.
However, since we want to use Cinemachine Collider together, it seems that we need to set the target of attention to Look At even though we are not doing automatic attention.
If you want to control the camera tracking for the player, you should set the body to "Do nothing".