Hi! I am starting a new project but I am a bit confused about the game I used as a reference.
I dont understand if it is 3d, 2d or 2.5d.
I think it is 2d but, in that case, how did they make that depth effect
making the ball smaller the further?¿How did they thow a 2d ball on z axis?
The game I am talking about is this:
https://www.youtube.com/watch?v=QQFqRlkxS3g
I’d appreciate it if you could help me.
Thanks for reading it.
The depth effect seems to be from decreasing the scale of the basketball once it’s shot.
public float shrinkSpeed = 1f; // tune this to control how quickly it shrinks
public float shrinkScale = .5f;
bool hasBeenShot;
float timeShot;
void ShootBall()
{
hasBeenShot = true;
timeShot = Time.time;
// launch it
}
void Update()
{
if(hasBeenShot)
{
float timeSinceShot = Time.time - timeShot;
// lerp to go from full scale (1f) to shrinkScale (.5f)
float scaler = Mathf.Lerp(1f, shrinkScale, timeSinceShot * shrinkSpeed);
transform.localScale = Vector3.one * scaler;
}
}
There are a bunch of ways to accomplish the same, but the above illustrates the basic idea.
Lo-renzo:
The depth effect seems to be from decreasing the scale of the basketball once it’s shot.
public float shrinkSpeed = 1f; // tune this to control how quickly it shrinks
public float shrinkScale = .5f;
bool hasBeenShot;
float timeShot;
void ShootBall()
{
hasBeenShot = true;
timeShot = Time.time;
// launch it
}
void Update()
{
if(hasBeenShot)
{
float timeSinceShot = Time.time - timeShot;
// lerp to go from full scale (1f) to shrinkScale (.5f)
float scaler = Mathf.Lerp(1f, shrinkScale, timeSinceShot * shrinkSpeed);
transform.localScale = Vector3.one * scaler;
}
}
There are a bunch of ways to accomplish the same, but the above illustrates the basic idea.
Thanks for the answer! I will try handling the scale similar to that and see how it looks.