COMO FAZER CAMERA ORBITAR O PLAYER/CAMERA LIVRE!
+2
Weslley
gabriel365br
6 participantes
Página 1 de 1
COMO FAZER CAMERA ORBITAR O PLAYER/CAMERA LIVRE!
preciso de um tutorial de como fazer a camera girar livremente pelo player, estilo gta que o jogador tem a opção de mover a camera para qualquer lado, ou como muitos dizem "Orbit Camera"
gabriel365br- Iniciante
- PONTOS : 2511
REPUTAÇÃO : 1
Respeito as regras :
Weslley- Moderador
-
PONTOS : 5172
REPUTAÇÃO : 735
Idade : 25
Áreas de atuação : https://weslleyxm.github.io/
Respeito as regras :
Re: COMO FAZER CAMERA ORBITAR O PLAYER/CAMERA LIVRE!
Bom dia Brother! Eu tenho esse script aqui, pra mim ele ficou ótimo, talvez funcione ai também. Ele é anexado a Main camera, o target é o player.
- Código:
var target : Transform;
var distance = 10.0;
var xSpeed = 250.0;
var ySpeed = 120.0;
var yMinLimit = -20;
var yMaxLimit = 80;
private var x = 0.0;
private var y = 0.0;
@script AddComponentMenu("Camera-Control/Mouse Orbit")
function Start () {
var angles = transform.eulerAngles;
x = angles.y;
y = angles.x;
// Make the rigid body not change rotation
if (GetComponent.<Rigidbody>())
GetComponent.<Rigidbody>().freezeRotation = true;
}
function LateUpdate () {
if (target) {
x += Input.GetAxis("Mouse X") * xSpeed * 0.02;
y -= Input.GetAxis("Mouse Y") * ySpeed * 0.02;
y = ClampAngle(y, yMinLimit, yMaxLimit);
var rotation = Quaternion.Euler(y, x, 0);
var position = rotation * Vector3(0.0, 0.0, -distance) + target.position;
transform.rotation = rotation;
transform.position = position;
}
}
static function ClampAngle (angle : float, min : float, max : float) {
if (angle < -360)
angle += 360;
if (angle > 360)
angle -= 360;
return Mathf.Clamp (angle, min, max);
}
Re: COMO FAZER CAMERA ORBITAR O PLAYER/CAMERA LIVRE!
valeu!weslleyFx escreveu:
gabriel365br- Iniciante
- PONTOS : 2511
REPUTAÇÃO : 1
Respeito as regras :
Re: COMO FAZER CAMERA ORBITAR O PLAYER/CAMERA LIVRE!
dstaroski escreveu:Bom dia Brother! Eu tenho esse script aqui, pra mim ele ficou ótimo, talvez funcione ai também. Ele é anexado a Main camera, o target é o player.
- Código:
var target : Transform;
var distance = 10.0;
var xSpeed = 250.0;
var ySpeed = 120.0;
var yMinLimit = -20;
var yMaxLimit = 80;
private var x = 0.0;
private var y = 0.0;
@script AddComponentMenu("Camera-Control/Mouse Orbit")
muito obrigado! valeu mesmo!
function Start () {
var angles = transform.eulerAngles;
x = angles.y;
y = angles.x;
// Make the rigid body not change rotation
if (GetComponent.<Rigidbody>())
GetComponent.<Rigidbody>().freezeRotation = true;
}
function LateUpdate () {
if (target) {
x += Input.GetAxis("Mouse X") * xSpeed * 0.02;
y -= Input.GetAxis("Mouse Y") * ySpeed * 0.02;
y = ClampAngle(y, yMinLimit, yMaxLimit);
var rotation = Quaternion.Euler(y, x, 0);
var position = rotation * Vector3(0.0, 0.0, -distance) + target.position;
transform.rotation = rotation;
transform.position = position;
}
}
static function ClampAngle (angle : float, min : float, max : float) {
if (angle < -360)
angle += 360;
if (angle > 360)
angle -= 360;
return Mathf.Clamp (angle, min, max);
}
gabriel365br- Iniciante
- PONTOS : 2511
REPUTAÇÃO : 1
Respeito as regras :
Re: COMO FAZER CAMERA ORBITAR O PLAYER/CAMERA LIVRE!
quero que a camera orbit mas em c# '-'
LucasR52- Iniciante
- PONTOS : 2453
REPUTAÇÃO : 0
Respeito as regras :

» Como posso girar a câmera envolta do player com touch
» Como mudar de camera assim que o player entrar no Trigger
» Como fazer a câmera começar com uma visão do topo e seguir o player
» como eu faço para a camera orbitar um objeto atraves de um joystick?????
» COMO FAÇO O EFEITO "SMOOTH" NA CAMERA DO PLAYER
» Como mudar de camera assim que o player entrar no Trigger
» Como fazer a câmera começar com uma visão do topo e seguir o player
» como eu faço para a camera orbitar um objeto atraves de um joystick?????
» COMO FAÇO O EFEITO "SMOOTH" NA CAMERA DO PLAYER
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos