/// <summary> /// Destroy a dynamic marker by it's ID. /// </summary> /// <param name="dynamicMarkerId">The ID of the marker.</param> /// <returns>True if successful, false otherwise.</returns> public static bool DestroyDynamicMarker(ulong dynamicMarkerId) { DynamicMarker marker = GetDynamicMarker(dynamicMarkerId); if (marker == null) { return(false); } AltEntitySync.RemoveEntity(marker); return(true); }
/// <summary> /// Get all created dynamic markers. /// </summary> /// <returns>A list of dynamic markers.</returns> public static List <DynamicMarker> GetAllDynamicMarkers( ) { List <DynamicMarker> markers = new List <DynamicMarker>( ); foreach (IEntity entity in AltEntitySync.GetAllEntities( )) { DynamicMarker obj = GetDynamicMarker(entity.Id); if (obj != null) { markers.Add(obj); } } return(markers); }
/// <summary> /// Create a new dynamic marker /// </summary> /// <param name="markerType">The type of marker to spawn.</param> /// <param name="position">The position at which the marker should spawn at.</param> /// <param name="scale">The scale of the marker.</param> /// <param name="rotation">The rotation of the marker.</param> /// <param name="direction">The direction of the marker.</param> /// <param name="color">The color of the marker.</param> /// <param name="bobUpDown">Whether the marker should bob up and down.</param> /// <param name="faceCamera">Whether the marker should face the entity's camera.</param> /// <param name="rotate">Whether the marker should rotate on the Y axis only.</param> /// <param name="textureDict">An optional texture dictionary to apply to the marker.</param> /// <param name="textureName">An optional texture name to apply to the marker.</param> /// <param name="drawOnEnter">Whether it should draw the marker onto an entity that intersects with it.</param> /// <param name="dimension">The dimension of the marker</param> /// <param name="streamRange">Stream distance of the marker, default is 100.</param> /// <returns></returns> public static DynamicMarker CreateDynamicMarker( MarkerTypes markerType, Vector3 position, Vector3 scale, Vector3?rotation = null, Vector3?direction = null, Rgba?color = null, bool?bobUpDown = false, bool?faceCamera = false, bool?rotate = false, string textureDict = null, string textureName = null, bool?drawOnEnter = false, int dimension = 0, uint streamRange = 100 ) { DynamicMarker marker = new DynamicMarker(position, dimension, streamRange, "marker") { Rotation = rotation ?? new Vector3(0), MarkerType = markerType, Direction = direction ?? new Vector3(0), Scale = scale, Color = color ?? null, BobUpDown = bobUpDown ?? null, FaceCamera = faceCamera ?? null, Rotate = rotate ?? null, TextureDict = textureDict ?? null, TextureName = textureName ?? null, DrawOnEnter = drawOnEnter ?? null }; AltEntitySync.AddEntity(marker); return(marker); }
/// <summary> /// Destroy a dynamic marker. /// </summary> /// <param name="marker">The marker instance to destroy.</param> public static void DestroyDynamicMarker(DynamicMarker marker) { AltEntitySync.RemoveEntity(marker); }