using System; using System.Collections.Generic; using System.Linq; using UnityEngine; namespace Oxide.Plugins { [Info("EntInfo", "imthenewguy", "1.0.0")] [Description("EntInfo")] class EntInfo : RustPlugin { [ChatCommand("getlocalpos")] private void GetLocalPosCommand(BasePlayer player, string cmd, string[] args) { MonumentInfo monument = TerrainMeta.Path.Monuments.Where(x => Vector3.Distance(x.transform.position, player.transform.position) < 150).FirstOrDefault(); if (monument == default(MonumentInfo)) { player.ChatMessage("Could not find monument near."); return; } player.ChatMessage($"You are currently near {monument.displayPhrase.english}"); Vector3 localPosition = monument.transform.InverseTransformPoint(player.transform.position); float localRotationAngle = player.HasParent() ? 180 - player.viewAngles.y : monument.transform.rotation.eulerAngles.y - player.viewAngles.y + 180; //player.transform.eulerAngles = new Vector3(localPosition.x, localRotationAngle, localPosition.z); - Does this allow me to change the rotation of an entity? My code. player.ChatMessage($"You are currently at local position: {localPosition}"); player.ChatMessage($"You are currently at local rotation: {localRotationAngle}"); } private const int LAYER_TARGET = ~(1 << 2 | 1 << 3 | 1 << 4 | 1 << 10 | 1 << 18 | 1 << 28 | 1 << 29); private BaseEntity GetTargetEntity(BasePlayer player) { RaycastHit raycastHit; bool flag = Physics.Raycast(player.eyes.HeadRay(), out raycastHit, 5, LAYER_TARGET); var targetEntity = flag ? raycastHit.GetEntity() : null; return targetEntity; } [ChatCommand("entinfo")] private void EntInfoCommand(BasePlayer player, string command, string[] args) { //if (!permission.UserHasGroup(player.UserIDString, "admin")) //{ // PrintToChat(player, "Not authed"); // return; //} var target = GetTargetEntity(player); if (target == null) { return; } //target.tag //BradleyAPC apc = new BradleyAPC(); player.ConsoleMessage($"{target.name}({target.PrefabName})[{target.net.ID}]<{target.prefabID}> - {target.transform.position}, {target.transform.rotation}"); } } }