mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
feat: props now align to the surface you place them on by default
This commit is contained in:
parent
56640a2228
commit
b7f3a587f7
@ -46,6 +46,10 @@ namespace NewHorizons.Utility
|
||||
PropPlacementData propData = RegisterProp_WithReturn(data.bodyName, prop);
|
||||
propData.initial_pos = data.pos;
|
||||
propData.initial_rotation = data.norm;
|
||||
|
||||
string origEul = prop.transform.localEulerAngles.ToString();
|
||||
prop.transform.localRotation = Quaternion.LookRotation(data.norm) * Quaternion.FromToRotation(Vector3.up, Vector3.forward);
|
||||
Logger.Log($"{data.norm.ToString()} -=- {prop.transform.localEulerAngles.ToString()} => {prop.transform.localEulerAngles.ToString()}");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -60,6 +64,11 @@ namespace NewHorizons.Utility
|
||||
|
||||
private static PropPlacementData RegisterProp_WithReturn(string bodyGameObjectName, GameObject prop)
|
||||
{
|
||||
if (Main.Debug)
|
||||
{
|
||||
// TOOD: make this prop an item
|
||||
}
|
||||
|
||||
string bodyName = bodyGameObjectName.Substring(0, bodyGameObjectName.Length-"_Body".Length);
|
||||
PropPlacementData data = new PropPlacementData
|
||||
{
|
||||
|
||||
@ -18,11 +18,20 @@ namespace NewHorizons.Utility
|
||||
private GameObject _normalSphere1;
|
||||
private GameObject _normalSphere2;
|
||||
|
||||
public string temp_placepath = "BrittleHollow_Body/Sector_BH/Sector_NorthHemisphere/Sector_NorthPole/Sector_HangingCity/Sector_HangingCity_District1/Props_HangingCity_District1/OtherComponentsGroup/Props_HangingCity_Building_10/Prefab_NOM_VaseThin";
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_rb = this.GetRequiredComponent<OWRigidbody>();
|
||||
}
|
||||
|
||||
//private void OnGui()
|
||||
//{
|
||||
// //TODO: add gui for stuff https://github.com/Bwc9876/OW-SaveEditor/blob/master/SaveEditor/SaveEditor.cs
|
||||
// // https://docs.unity3d.com/ScriptReference/GUI.TextField.html
|
||||
// GUILayout.BeginArea(new Rect(menuPosition.x, menuPosition.y, EditorMenuSize.x, EditorMenuSize.y), _editorMenuStyle);
|
||||
//}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!Main.Debug) return;
|
||||
@ -35,6 +44,7 @@ namespace NewHorizons.Utility
|
||||
|
||||
if (Keyboard.current[Key.L].wasReleasedThisFrame)
|
||||
{
|
||||
DebugPropPlacer.currentObject = temp_placepath;
|
||||
PlaceObject();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user