1
DOTween & DOTween Pro / Moving forward in local space.
« on: May 14, 2016, 05:39:28 PM »
Hi,
I am having with using DoLocalMoveZ to move forward. I have a character that I rotate then move forward on the transforms local z axis but it is using world z when I move. Basically it always moves up 3 on the world z axis but I need it to move up on the transforms z axis.
Here is an example of what I have.
//swipeUp
transform.parent.DORotate (new Vector3(0,0,0), 1F);
Move();
//swipeDown
transform.parent.DORotate (new Vector3(0,180,0), 1F);
Move();
private void Move()
{
transform.parent.DOLocalMoveZ(transform.parent.position.z + 3, 1f);
}
I am having with using DoLocalMoveZ to move forward. I have a character that I rotate then move forward on the transforms local z axis but it is using world z when I move. Basically it always moves up 3 on the world z axis but I need it to move up on the transforms z axis.
Here is an example of what I have.
//swipeUp
transform.parent.DORotate (new Vector3(0,0,0), 1F);
Move();
//swipeDown
transform.parent.DORotate (new Vector3(0,180,0), 1F);
Move();
private void Move()
{
transform.parent.DOLocalMoveZ(transform.parent.position.z + 3, 1f);
}