コード例 #1
0
ファイル: CommonEngine.cs プロジェクト: FoKycHuK/CVARC
        public Frame3D GetAbsoluteLocation(string id)
        {
            var obj = ObjectsCache.FindGameObject(id);
            var pos = obj.transform.position;
            var rot = obj.transform.rotation.eulerAngles;

            return(new Frame3D(pos.x, pos.y, pos.z,
                               Angle.FromGrad(rot.x),
                               Angle.FromGrad(rot.y),
                               Angle.FromGrad(rot.z)).ToCvarcBasis());
        }
コード例 #2
0
ファイル: CommonEngine.cs プロジェクト: FoKycHuK/CVARC
        private void UpdateSpeed(string requestedId, Frame3D speed)
        {
            var target = ObjectsCache.FindGameObject(requestedId);

            if (target == null)
            {
                return;
            }

            var gravityVelocity = target.GetComponent <Rigidbody>().velocity.y;

            target.GetComponent <Rigidbody>().velocity =
                new Vector3((float)speed.X, (float)speed.Y + gravityVelocity, (float)speed.Z);

            target.GetComponent <Rigidbody>().angularVelocity =
                new Vector3((float)speed.Pitch.Radian, (float)speed.Yaw.Radian, (float)speed.Roll.Radian);
        }
コード例 #3
0
ファイル: CommonEngine.cs プロジェクト: FoKycHuK/CVARC
        public void SetAbsoluteLocation(string id, Frame3D location)
        {
            this.Log("SetAbsoluteLocation", id, location);

            var obj           = ObjectsCache.FindGameObject(id);
            var unityLocation = location.ToUnityBasis();
            var newPosition   = new Vector3(
                (float)unityLocation.X,
                (float)unityLocation.Y,
                (float)unityLocation.Z);
            var newRotation = new Vector3(
                (float)unityLocation.Pitch.Simplify360().Grad,
                (float)unityLocation.Yaw.Simplify360().Grad,
                (float)unityLocation.Roll.Simplify360().Grad);

            obj.transform.position = newPosition;
            obj.transform.rotation = Quaternion.Euler(newRotation);
        }
コード例 #4
0
ファイル: CommonEngine.cs プロジェクト: FoKycHuK/CVARC
 public bool ContainBody(string id)
 {
     return(!(ObjectsCache.FindGameObject(id) == null));
 }