i want to make it so that when you aim in the game time will slow down, the other problem is while its doing this, i wanted the camera to zoom in from its third person isometric view to swoop down and come in from behind into the characters perspective, obviously i dont expect someone to tell me exactly what to do for everything but if someone could point me in the right directions with what types of codes to use or tutorials to follow id be very greatful, thankyou
In the future, please divide your questions…
For the slow motion part: LMGTFY - Let Me Google That For You
The part where you want to ‘swoop’ down into the character from third person perspective, you might want to take a look at iTween. You can find it in the asset store, and read more about it here: iTween for Unity by Bob Berkebile (pixelplacement)
iTween is really easy to use, and you can create a lot of nice camera motions with it in little time. To make the movement ‘into’ the character’s perspective, you could make the path of the iTween a child of the camera. That way, the movement is always relative to the position you are in…
Hope it helps!
You’re welcome. Please use the ‘comment’ option in the lower right corner of an answer to post comments. Also, use the hand symbols next to an answer to spread karma and mark an answer as accepted. Please do so for my answer in this post and any future posts that you participate in!
For your question I have recently used iTween to make the game slow down to a complete halt and at the same time zoom in on a specific object. You need iTween to do this, but you can use it if you want…
using UnityEngine;
using System.Collections;
public class MovementPlayerBoat : MonoBehaviour {
private float speed;
private float originalY;
private bool zoomState = false;
public Transform otherBoat;
public Transform otherBoatFront;
public GameObject cameraObject;
public TiltShift cameraTiltShift;
// Use this for initialization
void Start () {
speed = .15f;
originalY = transform.rotation.y;
}
void FixedUpdate () {
transform.Translate(new Vector3(0,0,speed * Time.timeScale));
if (Vector3.Distance(gameObject.transform.position,otherBoat.position) <= 150 && zoomState == false)
{
zoomState = true;
iTween.ValueTo(gameObject, iTween.Hash("from",1,"to",0,"time",1,"easetype",iTween.EaseType.easeInCubic,"onupdatetarget",gameObject,"onupdate","SlowDown"));
iTween.ValueTo(cameraObject, iTween.Hash("from",30,"to",4,"time",1,"easetype",iTween.EaseType.easeOutExpo,"onupdatetarget",gameObject,"onupdate","EaseInTiltShift"));
iTween.LookTo(cameraObject, iTween.Hash("looktarget",otherBoatFront,"time",1,"easeType",iTween.EaseType.easeInCubic));
cameraObject.animation.Play("ZoomIn");
}
}
void SlowDown (float timeFactor) {
Time.timeScale = timeFactor;
}
void EaseInTiltShift (float weight) {
cameraTiltShift.smoothness = weight;
}
}
Feel free to ask any questions about the code if you don’t understand it. As it’s something that I use only for my own work, it’s not commented at all. Sorry.