Hello,
The project is a projectile motion using a cannon. It is a
- Side scroller ( meant that the view is 2D).
- The canon has to be placed on the left corner and fire in a Projectile Fashion.
Expectation :
My main aim is to view the entire scene when enemy is spawned randomly (once per time). Mainly I want the user to have the vision as of where the enemy cube (target)
is placed. I would also want a transition to be smooth. Say, could take half a second. Moreover as because the cube is spawned
everytime it is instantiated, sometimes the cube might be very near the cannon. If that is the case - I would be happy if the cube
retreats back to the original position (something like in the screenshot “game_view”). I was just looking into the documentation
and I was thinking whether that would be possible either by alternating the z axis of the camera of it’s FOV. But I thought someone
who had prior experience in this type of scenario could guide me well. The entire game moves on X-Y Plane.
Hence at all cases Z co-ordinates is ‘0’.
ScreenShots:
-
Game View
The game view which is the normal position of the camera. Whenever the enemy is within this view I would prefer the camera to remain in this position. I mean I would like to camera to have this position as the least position and move from here to cover the enemy (which spawns only) onto the positive far end of X co-ordinates. -
Scene View
That cube at the far end is the enemy. It is the target for the enemy. -
FOV change
This is one of the options I had. -
Transform Z co-ordinates
Another option I have. -
Angry Birds :
I would like to have something like this. I think the camera lets the view the entire scene by just zooming out.
Code :
I have ideas in bits and pieces. But for the transition I could use Unity’s in build TIME function.
Enemy's Position :
The enemy’s position is set to random on one co-ordinate only. I set the position through,
function e_spawn()
{
pos = projscript.spawn();
var position: Vector3 = Vector3(pos, 1, 0);
Instantiate(ene_pos, position, Quaternion.identity);
}
The turret’s position is always fixed and It is set to Vector3(-0.02,1.05,0)
Request :
I humbly request is could someone help me out. I think I am stuck. If I am helped with some code, I would highly appreciate. I hope I did not feed in too much on information and at the same time provide all the required information.
Thank you very much