예제 #1
0
        /// <summary>
        /// Set position from world coordinates in the Unity coordinate system.
        /// </summary>
        public static void SetWorldPosition(int openDriveIndex, Vector3 position)
        {
            Vector3 odrPos = GetOpenDrivePosition(position);

            RoadManagerLibraryCS.SetWorldXYHPosition(openDriveIndex, odrPos.x, odrPos.y, 0);
            RoadManagerLibraryCS.GetPositionData(openDriveIndex, ref tmpPosData);
            RoadManagerLibraryCS.SetLanePosition(openDriveIndex, tmpPosData.roadId, tmpPosData.laneId, tmpPosData.laneOffset, tmpPosData.s, true);
        }
예제 #2
0
        /// <summary>
        /// Sets the given transform to match the position and rotation of the road user with handle index.
        /// </summary>
        /// <param name="openDriveIndex"></param>
        /// <param name="gameObjTransform">Transform of the road user game object.</param>
        public static void AlignGameObjectToHandle(int openDriveIndex, GameObject go)
        {
            RoadManagerLibraryCS.GetPositionData(openDriveIndex, ref tmpPosData);

            Vector3    pos = GetUnityPosition(tmpPosData);
            Quaternion rot = GetUnityRotation(tmpPosData);

            go.transform.SetPositionAndRotation(pos, rot);
        }
예제 #3
0
        /// <summary>
        /// Returns the world position and rotation of the road user with handle index.
        /// </summary>
        /// <param name="openDriveIndex"></param>
        /// <returns></returns>
        public static WorldPose GetWorldPose(int openDriveIndex)
        {
            WorldPose pose = new WorldPose();

            RoadManagerLibraryCS.GetPositionData(openDriveIndex, ref tmpPosData);
            pose.position = GetUnityPosition(tmpPosData);
            pose.rotation = GetUnityRotation(tmpPosData);

            return(pose);
        }
예제 #4
0
 public static void GetOpenDrivePositionDataUnityCoordinates(int openDriveIndex, ref OpenDrivePositionDataUnityCoordinates unityPosData)
 {
     RoadManagerLibraryCS.GetPositionData(openDriveIndex, ref tmpPosData);
     unityPosData.position   = GetUnityPosition(tmpPosData);
     unityPosData.rotation   = GetUnityRotation(tmpPosData);
     unityPosData.hRelative  = tmpPosData.hRelative;
     unityPosData.laneId     = tmpPosData.laneId;
     unityPosData.laneOffset = tmpPosData.laneOffset;
     unityPosData.roadId     = tmpPosData.roadId;
     unityPosData.s          = tmpPosData.s;
 }