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()); }
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); }
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); }
public bool ContainBody(string id) { return(!(ObjectsCache.FindGameObject(id) == null)); }