- Home /
Question by
MobinYaqoob · Jul 01, 2015 at 01:50 PM ·
unity 5unity 2dvectrosity
a path switch game
i'm trying to make a game in which player switch path on tap vice versa.
But in my case i use
while (distance<1.0f)
{
if (TouchInput.IsPlayerUp == true)
{
Vector3 sDist = spline.GetPoint3D01(distance);
Vector3 sDis2 = detuSplineScripts.GetDistanceSplineBelow().GetPoint3D01(distance);
player.transform.position = sDist;
isUp=true;
}else
{
if (isUp==true)
{
// distance = TouchInput.SplineBelowDistance;
player.transform.position = rayCasting.hitting.point;
lenghtOfHitPoint = rayCasting.hitting.point;
// Vector3 normalizedV = new Vector3();
normalizedV.x = lenghtOfHitPoint.x / detuSplineScripts.GetDistanceSplineBelow().GetLength();
normalizedV.y = lenghtOfHitPoint.y / detuSplineScripts.GetDistanceSplineBelow().GetLength();
isUp=false;
}
}
distance+=Time.deltaTime*speed;
yield return 0;
}
it switches the path but not the picture like some time it move far from player or -far from player
untitled.png
(24.9 kB)
Comment
Your answer
Follow this Question
Related Questions
Diffrent TimeScale Different Scene 1 Answer
How do i change the sprite on a sprite renderer without changing the size? 1 Answer
2d game end level with trigger and colission with trigger who to make a if condition 1 Answer
LocalScale doesn't scale sprite to the distance specified 0 Answers
i need help with black lines 0 Answers