Demigiant Forum
Unity Assets => DOTween & DOTween Pro => Topic started by: r_chevallier on December 03, 2015, 07:37:10 AM
-
Hello,
I have a rocket prefab that spawns in different directions throughout the game so I can't just have 1 transform move direction.
Is their an equivalent to "transform.forward". Your asset is much easier to move objects than Unity's native code.
I have gotten the below Unity code to work but want to use your asset for better control.
transform.Translate(Vector3.right * Time.deltaTime * speed,Space.Self);
Thanks,
Raymond
-
Hi,
You can simply use Transform.forward and multiply it for the distance you want to achieve, then use SetRelative. For example, this will send your rocket forward for 5 units in 2 seconds, depending on its rotation.
transform.DOMove(transform.forward * 5, 2).SetRelative();
-
Hi
why not add to the API a method like SetUseAxis(def = true) which allows to use the forward/right/up axis e.g.:
Instead of
transform.parent.DOLocalMove( transform.parent.up*moveDistance,duration).SetRelative(true)
use something like
transform.parent.DOLocalMoveX/Y/Z(moveDistance,moveDuration*moveSpeed).SetRelative(true).SetUseAxis();
which under the hood will do (transform.parent.right/up/forward)*moveDistance
and which will move along the Local Axis (forward/right/up).
have a nice day.
-
Hi,
This is interesting. Adding it to my todo list and will see if it's doable :)
Cheers,
Daniele
-
Buon divertimento ;D
Hi,
This is interesting. Adding it to my todo list and will see if it's doable :)
Cheers,
Daniele
-
Ahaha grazie :D