From 09a24844e89d236e7b7db1900a9346c14910c352 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 11 May 2022 20:36:31 -0400 Subject: [PATCH] Allow computers to align to a given normal --- NewHorizons/Builder/Props/NomaiTextBuilder.cs | 1 + NewHorizons/schema.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Props/NomaiTextBuilder.cs b/NewHorizons/Builder/Props/NomaiTextBuilder.cs index a4077887..69388188 100644 --- a/NewHorizons/Builder/Props/NomaiTextBuilder.cs +++ b/NewHorizons/Builder/Props/NomaiTextBuilder.cs @@ -161,6 +161,7 @@ namespace NewHorizons.Builder.Props computerObject.transform.localPosition = info?.position ?? Vector3.zero; var up = computerObject.transform.position - go.transform.position; + if (info.normal != null) up = go.transform.TransformDirection(info.normal); computerObject.transform.rotation = Quaternion.FromToRotation(Vector3.up, up) * computerObject.transform.rotation; var computer = computerObject.GetComponent(); diff --git a/NewHorizons/schema.json b/NewHorizons/schema.json index 6777c12c..7c3e8336 100644 --- a/NewHorizons/schema.json +++ b/NewHorizons/schema.json @@ -936,7 +936,7 @@ }, "normal": { "$ref": "#/$defs/vector3", - "description": "The normal vector for this object. Only used for writing on walls to orient it properly." + "description": "The normal vector for this object. Used for writing on walls and positioning computers." }, "rotation": { "$ref": "#/$defs/vector3",