- Home /
This post has been wikified, any user with enough reputation can edit it.
Moving Platform with multiple targets
Hi, I'm new to unity, but I guess my question is pretty simple: I'm using Lerpz 2D project, and I need a moving platform to move more than 2 targets, so how do I add more targets? Already created vars for each target, but the platform reaction is to fly faraway from the targets...except target A.
heres the script:
var targetA : GameObject; var targetB : GameObject; var targetC : GameObject; var targetD : GameObject; var targetE : GameObject; var targetF : GameObject; var targetG : GameObject;
var speed : float = 0.1;
function FixedUpdate () { var weight = Mathf.Cos(Time.time speed 2 Mathf.PI) 0.5 + 0.5; transform.position = targetA.transform.position weight + targetB.transform.position (1-weight)
+ targetC.transform.position * (1-weight)
+ targetD.transform.position * (1-weight)
+ targetE.transform.position * (1-weight)
+ targetF.transform.position * (1-weight)
+ targetG.transform.position * (1-weight);
Comment