mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
parent
39840b18a7
commit
ef24245c60
@ -18,7 +18,16 @@ namespace NewHorizons.Builder.General
|
||||
spawnGO.transform.localPosition = module.PlayerSpawnPoint;
|
||||
|
||||
playerSpawn = spawnGO.AddComponent<SpawnPoint>();
|
||||
spawnGO.transform.rotation = Quaternion.FromToRotation(Vector3.up, (playerSpawn.transform.position - planetGO.transform.position).normalized);
|
||||
|
||||
if(module.PlayerSpawnRotation != null)
|
||||
{
|
||||
spawnGO.transform.rotation = Quaternion.Euler(module.PlayerSpawnRotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnGO.transform.rotation = Quaternion.FromToRotation(Vector3.up, (playerSpawn.transform.position - planetGO.transform.position).normalized);
|
||||
}
|
||||
|
||||
spawnGO.transform.position = spawnGO.transform.position + spawnGO.transform.TransformDirection(Vector3.up) * 4f;
|
||||
}
|
||||
if (module.ShipSpawnPoint != null)
|
||||
@ -34,9 +43,17 @@ namespace NewHorizons.Builder.General
|
||||
|
||||
var ship = GameObject.Find("Ship_Body");
|
||||
ship.transform.position = spawnPoint.transform.position;
|
||||
ship.transform.rotation = Quaternion.FromToRotation(Vector3.up, (spawnPoint.transform.position - planetGO.transform.position).normalized);
|
||||
// Move it up a bit more
|
||||
ship.transform.position = ship.transform.position + ship.transform.TransformDirection(Vector3.up) * 4f;
|
||||
|
||||
if(module.ShipSpawnRotation != null)
|
||||
{
|
||||
ship.transform.rotation = Quaternion.Euler(module.ShipSpawnRotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
ship.transform.rotation = Quaternion.FromToRotation(Vector3.up, (spawnPoint.transform.position - planetGO.transform.position).normalized);
|
||||
// Move it up a bit more when aligning to surface
|
||||
ship.transform.position = ship.transform.position + ship.transform.TransformDirection(Vector3.up) * 4f;
|
||||
}
|
||||
|
||||
ship.GetRequiredComponent<MatchInitialMotion>().SetBodyToMatch(owRigidBody);
|
||||
|
||||
|
||||
2
NewHorizons/External/Modules/SpawnModule.cs
vendored
2
NewHorizons/External/Modules/SpawnModule.cs
vendored
@ -4,7 +4,9 @@ namespace NewHorizons.External.Modules
|
||||
public class SpawnModule
|
||||
{
|
||||
public MVector3 PlayerSpawnPoint { get; set; }
|
||||
public MVector3 PlayerSpawnRotation { get; set; }
|
||||
public MVector3 ShipSpawnPoint { get; set; }
|
||||
public MVector3 ShipSpawnRotation { get; set; }
|
||||
public bool StartWithSuit { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1099,8 +1099,17 @@
|
||||
"$ref": "#/$defs/vector3",
|
||||
"description": "If you want the player to spawn on the new body, set a value for this. Press \"P\" in game with Debug mode on to have the game log the position you're looking at to find a good value for this."
|
||||
},
|
||||
"playerSpawnRotation": {
|
||||
"$ref": "#/$defs/vector3",
|
||||
"description": "Euler angles by which the player will be oriented."
|
||||
},
|
||||
"shipSpawnPoint": {
|
||||
"$ref": "#/$defs/vector3"
|
||||
"$ref": "#/$defs/vector3",
|
||||
"description": "Required for the system to be accessible by warp drive."
|
||||
},
|
||||
"shipSpawnRotation": {
|
||||
"$ref": "#/$defs/vector3",
|
||||
"description": "Euler angles by which the ship will be oriented."
|
||||
},
|
||||
"startWithSuit": {
|
||||
"type": "boolean",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user