circle does not rotate when y axis is applied to camera
In my game there is a 2d circle and a curved path. circle does not rotate when y axis is applied to camera. I want the camera to move the y-axis and show the circle rotating I want my circle to turn left and right on the y-axis.
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class myCircle : MonoBehaviour { public float hiz; private Rigidbody2D rb;
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
void FixedUpdate() { float yatay = Input.GetAxis("Horizontal"); float dikey = Input.GetAxis("Vertical"); Vector3 hareket = new Vector3(yatay, dikey, 0.0f); rb.AddForce(hareket*hiz); }
}
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class kamera : MonoBehaviour { public Transform thePlayer;
private Vector3 offset;
void Start()
{
offset = transform.position - thePlayer.position;
}
void Update()
{
Vector3 cameraNewPosition = new Vector3(thePlayer.position.x + offset.x, thePlayer.position.y+offset.y, thePlayer.position.z + offset.z);
transform.position = cameraNewPosition;
}
} note; if I type offset.y the circle rotates but the camera does not move on the y-axis
Your answer
Follow this Question
Related Questions
Orbit camera with mouse control script problems 1 Answer
Is my MonoDeveloped Glitchd ??? 1 Answer
Acceleration into world frame of reference. 0 Answers
Camera rotation 2 Answers
Camera Controller Script - locked Y Axis 0 Answers