You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
|
- using System;
- using System.Collections.Generic;
- using UnityEngine;
-
- class ActionSetRotation : Action
- {
- protected Vector3 value;
-
- public ActionSetRotation(Vector3 tgtValue)
- : base()
- {
- value = tgtValue;
- }
-
- public override Action clone()
- {
- return new ActionSetRotation(value);
- }
-
- public override void start()
- {
- base.start();
- Vector3 path = new Vector3();
- for (int i = 0; i < 3; i++)
- {
- path[i] = value[i] - target.gameObject.transform.rotation.eulerAngles[i];
- }
- target.gameObject.transform.Rotate(Vector3.up, path.y);
- target.gameObject.transform.Rotate(Vector3.right, path.x);
- target.gameObject.transform.Rotate(Vector3.forward, path.z);
- }
- }
|