system
1
Hello Everyone,I am beginner for unity and trying to make game of aeroplane like Air Strike 3d …
I need help in camera section. I want to move my cam just like in that game where it is following the Airplane along x axis as well as when air plane goes to left it scrolls on left for say 100 m and same goes with right
I dont think its smooth follow because it is not following airplane i guess … Please please help me with the soultion
I tried making a new empty game object and drag both camera and airplane in it …and then tried smooth follow script but its not the way i wanted…
I am sory if i could not explain the problem properly here is the link of the Air Strike 3d
this is the link Air Strike 3D - Intro + MISSION 01: Tutorial - YouTube
check the video after 4.42 minutes to avoid the information screen and all…
See in that screen scrolls little bit left …right and i dont think its smooth follow if it is then please provide me the solution…if possible i will be very thankful…
I don’t think the camera is following the player along the x (I don’t think its the x-axis, but you know what I mean^^), but the player is following the camera! (he is limited how far he can go forward and backward depending on the position of the camera)
Ok… now the scrolling… I think the camera starts scrolling as soon as the player is at certain distance to the player.
if(Math.Abs(Camera.main.transform.position - transform.position) > scrollDistance){
//start moving camera
}
system
3
Thanks dude you made my day …
( by the way i understood what you meant ^-^) …Sorry
By the way I have done this and it is working but my when my airplane goes to left it goes smoothly but when i try to come back again to the normal position or to d right
Airplane gets jerk or shock … ( understood what i mean …
)
what should i do about that jerk … ?
var scrollDistance:float =100.0;
private var endtarget=100.0;
working
function Update(){
/*transform.position.y=currentHeight;
transform.position.z = target.position.z - distance;*/
if(Mathf.Abs(Camera.main.transform.position.x - transform.position.x) > scrollDistance)
{
//start moving camera
Camera.main.transform.position.x= transform.position.x + endtarget;
}
}