[QUOTE=Zero Vector;42770030]This is fun! But what is this?
[img]http://i.imgur.com/I2PrpBA.png[/img]
Nothing happens when I hit it.[/QUOTE]
Planned obstacle that I forgot to take out, just had a test model at the start. Will probably add it after work, currentI plan is to partly slow you down and stop you earning points from gates for a short period
Bought UFPS and Daikon Forge in preparation for my Oculus Rift arriving soon.
[sp]Time to make nothing.[/sp]
[QUOTE=Zazibar;42780512]Bought UFPS and Daikon Forge in preparation for my Oculus Rift arriving soon.
[sp]Time to make nothing.[/sp][/QUOTE]
Make an FPS inspired by Hollywood action films - camera shaking, lots of lens flares, lots of explosions, and plenty more. It'd be like walking through a real set.
Good god, why is it so difficult to make a player not slide on a moving planet without breaking all kinds of other shit.
Anyone used [url=http://fernandoribeirogames.wix.com/umabeta]UMA[/url] before? Still in Beta, but apparently it'll be a completely free asset when its finished.
[QUOTE=Pelf;42781829]Good god, why is it so difficult to make a player not slide on a moving planet without breaking all kinds of other shit.[/QUOTE]
Hmm, I don't know how your project is set up but what about something simple:
[code]
private bool planetCollision = false;
void OnCollisionEnter (collider other) {
if(other.collider.tag == "planet") {
planetCollision = true;
}
}
void Update () {
if(planetCollision == true) {
rigidbody.velocity = Vector3.zero;
// OR if you want the object to rotate with the planet insert it here.
}
if(Input.GetKey("insert acceleration key here")) {
planetCollision = false;
// Insert move script here
}
}[/code]
I haven't tested the script, but the idea should be somewhat functional. Again I don't know how your game works so this is simple a shot in the dark.
[editline]7th November 2013[/editline]
Just noticed that it's probably not what you were asking, so this might be irrelevant. If so just ignore.
Ok so here's a video of most of the issues with it right now:
[video=youtube;-Zn8hgkOXtM]http://www.youtube.com/watch?v=-Zn8hgkOXtM[/video]
And here is my entire script. Are there any glaring errors you can find?
[code]using UnityEngine;
using System;
using System.Collections;
[RequireComponent(typeof(Rigidbody))]
public class LanderController : MonoBehaviour
{
[System.Serializable]
[ExecuteInEditMode]
public class CelestialObjects
{
public Transform celestialObject;
public float mass;
public float heatFlux;
}
public CelestialObjects[] SpaceObjects;
public GUISkin landerGuiSkin;
public Texture2D structureBar;
public Texture2D temperatureBar;
public Texture2D background;
public GameObject engineParticles;
public GameObject landerExplosion;
public GameObject LanderMesh;
public LayerMask triggerCullingMask;
public int maxCameraOrthoSize;
public float startingCameraZoom;
public Vector3 InitialVelocity;
private float EnginePower = 50;
private float RollStrength = 20;
private float maxStructuralIntegrity = 5;
private float heatResistance = 3000;
private Vector3 rigidbodyVelocity = Vector3.zero;
private bool hasCalledExplode = false;
private Vector3 curPlanetPos = Vector3.zero;
private Vector3 prevPlanetPos = Vector3.zero;
private Transform activePlanet = null;
private float planetOrbitSpeed = 0;
private float planetSpinSpeed = 0;
private bool isOnMovingPlanet = false;
private float collisionTime;
private float orbitalSpeed;
private float temperature;
private string heatStatus = "";
private int temperatureBarWidth;
private int temperaturePosY = 80;
private float structure;
private float structuralIntegrity
{
get { return structure; }
set
{
if ( value < 0.01f )
structure = 0;
else
structure = value;
}
}
void Awake()
{
ConfigSettings.SetUpScript(); // Delete this for final release
ConfigSettings.LoadConfigFile(); // Delete this for final release
structuralIntegrity = maxStructuralIntegrity; // Value will be retrieved from scenario handler
Camera.main.orthographicSize = startingCameraZoom;
}
void Start()
{
// Apply Initial Velocity
rigidbody.velocity = InitialVelocity;
}
void Update()
{
// Get player input
DetectInput();
// Kill player if no health remains
if ( structure == 0 )
StartCoroutine(KillLander());
// Check if ship has lost all structural integrity
if ( structuralIntegrity <= 0 )
StartCoroutine(KillLander());
//================================================== =====================================//
float curTemperature = 0;
float maxTemperature = 0;
foreach ( CelestialObjects spaceObj in SpaceObjects )
{
if ( spaceObj.heatFlux > 0 )
{
// Get distance between player and hotspot
float sqrDistance = (spaceObj.celestialObject.position - transform.position).sqrMagnitude;
// Calculate temperature from hotspot
curTemperature = Mathf.Pow(2.71828f, sqrDistance / -100) * spaceObj.heatFlux;
// Assigns the hottest temperature
if ( curTemperature > maxTemperature )
maxTemperature = curTemperature;
}
}
temperature = maxTemperature;
// Check if ship has overheated
if ( temperature >= heatResistance )
StartCoroutine(KillLander());
//================================================== =====================================//
// Update GUI Variables
orbitalSpeed = 4 * rigidbodyVelocity.magnitude;
temperatureBarWidth = Mathf.RoundToInt(temperature / 25);
// Handle sliding of temperature display
if ( temperatureBarWidth >= 1 )
temperaturePosY += Mathf.RoundToInt(100 * Time.deltaTime);
else
temperaturePosY -= Mathf.RoundToInt(100 * Time.deltaTime);
// Clamp position of temperature display
temperaturePosY = Mathf.Clamp(temperaturePosY, 45, 80);
// Updating Temperature Status for GUI display
if ( temperature < 1500 )
{
heatStatus = "nominal";
}
else if ( temperature < 2300 )
{
heatStatus = "danger";
}
else if ( temperature < 3000 )
{
heatStatus = "critical";
}
else
{
heatStatus = "overheat";
}
}
void LateUpdate()
{
// Keep camera from spinning with lander
Camera.main.transform.rotation = Quaternion.identity;
}
void OnGUI()
{
GUI.depth = 3;
GUI.skin = landerGuiSkin;
// Temperature Status Bar
GUILayout.BeginArea(new Rect(0, temperaturePosY, 300, 35));
GUI.Label(new Rect(15, 0, 300, 35), "Temperature: ");
GUI.DrawTexture(new Rect(160, 4, temperatureBarWidth, 24), temperatureBar);
GUI.Label(new Rect(165, 0, 200, 35), heatStatus);
GUILayout.EndArea();
// HUD Background
GUI.DrawTexture(new Rect(0, 0, 457, 80), background);
// Get size of structure bar
int structureBarSize = Mathf.RoundToInt(structure * 30);
if ( structureBarSize < 1 )
structureBarSize = 1;
// Round structure to nearest hundredth
float structureRounded = Mathf.Round(structure * 100) / 100;
// Structure Label & Bar
GUI.Label(new Rect(15, 10, 350, 35), "Structural Integrity Index:");
GUI.DrawTexture(new Rect(295, 14, structureBarSize, 24), structureBar);
// Structure Counter - Black numbers
Rect blackCounterRect = new Rect(295, 10, structureBarSize, 35);
GUILayout.BeginArea(blackCounterRect);
GUI.contentColor = Color.black;
GUI.Label(new Rect(0, 0, 100, 35), " " + structureRounded);
GUILayout.EndArea();
// Structure Counter - White numbers
Rect whiteCounterRect = new Rect(295 + structureBarSize, 10, 100, 35);
GUILayout.BeginArea(whiteCounterRect);
GUI.contentColor = Color.white;
GUI.Label(new Rect(-structureBarSize, 0, 100, 35), " " + structureRounded);
GUILayout.EndArea();
// Absolute Speed Counter
GUI.Label(new Rect(15, 45, 300, 35), "Absolute Speed: " + Mathf.Round(orbitalSpeed * 10) / 10 + " km/s");
}
void DetectInput()
{
// Thrust Up
if ( Input.GetKey(ConfigSettings.KeyThrust) )
{
rigidbody.AddRelativeForce(Vector3.up * EnginePower * Time.deltaTime);
PlayerData.HasGameStarted = true;
engineParticles.particleSystem.Play();
}
else
{
engineParticles.particleSystem.Stop();
}
// Roll Counter-Clockwise
if ( Input.GetKey(ConfigSettings.KeyRollLeft) )
{
rigidbody.AddRelativeTorque(Vector3.forward * RollStrength * Time.deltaTime);
}
// Roll Clockwise
if ( Input.GetKey(ConfigSettings.KeyRollRight) )
{
rigidbody.AddRelativeTorque(Vector3.forward * -RollStrength * Time.deltaTime);
}
float cameraOrthoSize = Camera.main.orthographicSize;
// Zoom in
if ( (Input.GetKey(KeyCode.UpArrow) || Input.GetAxis("MouseWheel") > 0) && cameraOrthoSize > 2 )
Camera.main.orthographicSize -= Time.deltaTime * cameraOrthoSize * ConfigSettings.MouseWheelSensitivity;
// Zoom out
if ( (Input.GetKey(KeyCode.DownArrow) || Input.GetAxis("MouseWheel") < 0) && Camera.main.orthographicSize < maxCameraOrthoSize )
Camera.main.orthographicSize += Time.deltaTime * cameraOrthoSize * ConfigSettings.MouseWheelSensitivity;
// DEBUG - RESTART LEVEL
if ( Input.GetKeyDown(KeyCode.Backspace) )
{
Application.LoadLevel(Application.loadedLevel);
}
}
void OnCollisionEnter(Collision collisionInfo)
{
collisionTime = Time.time;
float collisionMagnitude = collisionInfo.relativeVelocity.magnitude;
Debug.Log("Collision Magnitude: " + collisionMagnitude);
// Handle Structural Integrity
if ( collisionMagnitude > 0.8f )
{
float crashDamage = 5 * (collisionMagnitude - 0.8f);
structuralIntegrity -= crashDamage;
}
if ( collisionInfo.collider.tag == "Planet" )
{
bool syncOrbit;
bool syncRevolve;
try
{
// Get planet's orbital rotation speed
RotateObject rotationScript = collisionInfo.collider.gameObject.transform.parent .GetComponent<RotateObject>();
planetOrbitSpeed = rotationScript.speed;
syncOrbit = true;
}
catch ( NullReferenceException )
{
Debug.Log("Error Getting Orbital Speed: Planet does not orbit");
syncOrbit = false;
}
try
{
// Get speed that planet rotates on it's axis
RotateObject rotationScript = collisionInfo.collider.gameObject.GetComponent<RotateObject>();
planetSpinSpeed = rotationScript.speed;
syncRevolve = true;
}
catch ( NullReferenceException )
{
Debug.Log("Error Getting Revolution Speed: Planet does not revolve");
syncRevolve = false;
}
if ( syncOrbit == true || syncRevolve == true )
{
// Get Planet Position & Transform Data
Transform colliderTransform = collisionInfo.collider.transform;
activePlanet = colliderTransform;
prevPlanetPos = activePlanet.position;
curPlanetPos = activePlanet.position;
// Enable Player-Planet Position Synchronizing
isOnMovingPlanet = true;
}
}
}
void OnCollisionExit()
{
if ( isOnMovingPlanet == true )
{
// Disable Player-Planet Position Synchronizing
isOnMovingPlanet = false;
// Add Difference in Planet Velocity and Player Velocity
Vector3 planetVelocity = (curPlanetPos - prevPlanetPos) / Time.fixedDeltaTime;
Vector3 addVelocity = planetVelocity - rigidbodyVelocity;
rigidbody.velocity += addVelocity;
}
}
void FixedUpdate()
{
// Update velocity of player
rigidbodyVelocity = rigidbody.velocity;
float gravityForce;
float gravityConstant = 0.01f;
foreach ( CelestialObjects spaceObj in SpaceObjects )
{
if ( spaceObj.mass > 0 )
{
// Calculate the direction of gravity
Vector3 gravityVector = rigidbody.position - spaceObj.celestialObject.position;
// Calculate distance to planet's center of gravity
float distance = gravityVector.magnitude;
// Normalize the gravity vector
gravityVector = gravityVector / distance;
// Calculate gravitational force
gravityForce = (-gravityConstant * rigidbody.mass * spaceObj.mass) / (distance * distance);
// Apply gravitational force
rigidbody.AddForce(gravityVector * gravityForce);
}
}
//================================================== =====================================//
if ( isOnMovingPlanet == true )
{
// Update planet positions
prevPlanetPos = curPlanetPos;
curPlanetPos = activePlanet.position;
SyncToPlanetMotion();
}
}
void SyncToPlanetMotion()
{
// Get Planet Move Distance
Vector3 planetMotion = curPlanetPos - prevPlanetPos;
if ( isOnMovingPlanet == true )
{
// Move player position
transform.position += planetMotion;
// Rotate Player
transform.RotateAround(activePlanet.position, Vector3.forward, planetOrbitSpeed * Time.fixedDeltaTime);
transform.RotateAround(activePlanet.position, Vector3.forward, planetSpinSpeed * Time.fixedDeltaTime);
}
}
void OnParticleCollision()
{
// Apply random damage if player flies through volcano
float particleDamage = UnityEngine.Random.Range(0.1f, 0.5f);
structuralIntegrity -= particleDamage;
}
public IEnumerator KillLander()
{
PlayerData.HasLost = true;
LanderMesh.SetActive(false);
engineParticles.particleSystem.Stop();
rigidbody.constraints = RigidbodyConstraints.FreezeAll;
if ( hasCalledExplode == false )
{
hasCalledExplode = true;
landerExplosion.particleSystem.Play();
yield return new WaitForSeconds(3);
landerExplosion.particleSystem.Stop();
}
}
}
[/code]
Any unrelated tips or suggestions on coding techniques/methods?
I think you should look at the MVC pattern, it would apply well to this imo.
[QUOTE=Pelf;42787136]Ok so here's a video of most of the issues with it right now:
[video=youtube;-Zn8hgkOXtM]http://www.youtube.com/watch?v=-Zn8hgkOXtM[/video]
And here is my entire script. Are there any glaring errors you can find?
[code]using UnityEngine;
using System;
using System.Collections;
[RequireComponent(typeof(Rigidbody))]
public class LanderController : MonoBehaviour
{
[System.Serializable]
[ExecuteInEditMode]
public class CelestialObjects
{
public Transform celestialObject;
public float mass;
public float heatFlux;
}
public CelestialObjects[] SpaceObjects;
public GUISkin landerGuiSkin;
public Texture2D structureBar;
public Texture2D temperatureBar;
public Texture2D background;
public GameObject engineParticles;
public GameObject landerExplosion;
public GameObject LanderMesh;
public LayerMask triggerCullingMask;
public int maxCameraOrthoSize;
public float startingCameraZoom;
public Vector3 InitialVelocity;
private float EnginePower = 50;
private float RollStrength = 20;
private float maxStructuralIntegrity = 5;
private float heatResistance = 3000;
private Vector3 rigidbodyVelocity = Vector3.zero;
private bool hasCalledExplode = false;
private Vector3 curPlanetPos = Vector3.zero;
private Vector3 prevPlanetPos = Vector3.zero;
private Transform activePlanet = null;
private float planetOrbitSpeed = 0;
private float planetSpinSpeed = 0;
private bool isOnMovingPlanet = false;
private float collisionTime;
private float orbitalSpeed;
private float temperature;
private string heatStatus = "";
private int temperatureBarWidth;
private int temperaturePosY = 80;
private float structure;
private float structuralIntegrity
{
get { return structure; }
set
{
if ( value < 0.01f )
structure = 0;
else
structure = value;
}
}
void Awake()
{
ConfigSettings.SetUpScript(); // Delete this for final release
ConfigSettings.LoadConfigFile(); // Delete this for final release
structuralIntegrity = maxStructuralIntegrity; // Value will be retrieved from scenario handler
Camera.main.orthographicSize = startingCameraZoom;
}
void Start()
{
// Apply Initial Velocity
rigidbody.velocity = InitialVelocity;
}
void Update()
{
// Get player input
DetectInput();
// Kill player if no health remains
if ( structure == 0 )
StartCoroutine(KillLander());
// Check if ship has lost all structural integrity
if ( structuralIntegrity <= 0 )
StartCoroutine(KillLander());
//================================================== =====================================//
float curTemperature = 0;
float maxTemperature = 0;
foreach ( CelestialObjects spaceObj in SpaceObjects )
{
if ( spaceObj.heatFlux > 0 )
{
// Get distance between player and hotspot
float sqrDistance = (spaceObj.celestialObject.position - transform.position).sqrMagnitude;
// Calculate temperature from hotspot
curTemperature = Mathf.Pow(2.71828f, sqrDistance / -100) * spaceObj.heatFlux;
// Assigns the hottest temperature
if ( curTemperature > maxTemperature )
maxTemperature = curTemperature;
}
}
temperature = maxTemperature;
// Check if ship has overheated
if ( temperature >= heatResistance )
StartCoroutine(KillLander());
//================================================== =====================================//
// Update GUI Variables
orbitalSpeed = 4 * rigidbodyVelocity.magnitude;
temperatureBarWidth = Mathf.RoundToInt(temperature / 25);
// Handle sliding of temperature display
if ( temperatureBarWidth >= 1 )
temperaturePosY += Mathf.RoundToInt(100 * Time.deltaTime);
else
temperaturePosY -= Mathf.RoundToInt(100 * Time.deltaTime);
// Clamp position of temperature display
temperaturePosY = Mathf.Clamp(temperaturePosY, 45, 80);
// Updating Temperature Status for GUI display
if ( temperature < 1500 )
{
heatStatus = "nominal";
}
else if ( temperature < 2300 )
{
heatStatus = "danger";
}
else if ( temperature < 3000 )
{
heatStatus = "critical";
}
else
{
heatStatus = "overheat";
}
}
void LateUpdate()
{
// Keep camera from spinning with lander
Camera.main.transform.rotation = Quaternion.identity;
}
void OnGUI()
{
GUI.depth = 3;
GUI.skin = landerGuiSkin;
// Temperature Status Bar
GUILayout.BeginArea(new Rect(0, temperaturePosY, 300, 35));
GUI.Label(new Rect(15, 0, 300, 35), "Temperature: ");
GUI.DrawTexture(new Rect(160, 4, temperatureBarWidth, 24), temperatureBar);
GUI.Label(new Rect(165, 0, 200, 35), heatStatus);
GUILayout.EndArea();
// HUD Background
GUI.DrawTexture(new Rect(0, 0, 457, 80), background);
// Get size of structure bar
int structureBarSize = Mathf.RoundToInt(structure * 30);
if ( structureBarSize < 1 )
structureBarSize = 1;
// Round structure to nearest hundredth
float structureRounded = Mathf.Round(structure * 100) / 100;
// Structure Label & Bar
GUI.Label(new Rect(15, 10, 350, 35), "Structural Integrity Index:");
GUI.DrawTexture(new Rect(295, 14, structureBarSize, 24), structureBar);
// Structure Counter - Black numbers
Rect blackCounterRect = new Rect(295, 10, structureBarSize, 35);
GUILayout.BeginArea(blackCounterRect);
GUI.contentColor = Color.black;
GUI.Label(new Rect(0, 0, 100, 35), " " + structureRounded);
GUILayout.EndArea();
// Structure Counter - White numbers
Rect whiteCounterRect = new Rect(295 + structureBarSize, 10, 100, 35);
GUILayout.BeginArea(whiteCounterRect);
GUI.contentColor = Color.white;
GUI.Label(new Rect(-structureBarSize, 0, 100, 35), " " + structureRounded);
GUILayout.EndArea();
// Absolute Speed Counter
GUI.Label(new Rect(15, 45, 300, 35), "Absolute Speed: " + Mathf.Round(orbitalSpeed * 10) / 10 + " km/s");
}
void DetectInput()
{
// Thrust Up
if ( Input.GetKey(ConfigSettings.KeyThrust) )
{
rigidbody.AddRelativeForce(Vector3.up * EnginePower * Time.deltaTime);
PlayerData.HasGameStarted = true;
engineParticles.particleSystem.Play();
}
else
{
engineParticles.particleSystem.Stop();
}
// Roll Counter-Clockwise
if ( Input.GetKey(ConfigSettings.KeyRollLeft) )
{
rigidbody.AddRelativeTorque(Vector3.forward * RollStrength * Time.deltaTime);
}
// Roll Clockwise
if ( Input.GetKey(ConfigSettings.KeyRollRight) )
{
rigidbody.AddRelativeTorque(Vector3.forward * -RollStrength * Time.deltaTime);
}
float cameraOrthoSize = Camera.main.orthographicSize;
// Zoom in
if ( (Input.GetKey(KeyCode.UpArrow) || Input.GetAxis("MouseWheel") > 0) && cameraOrthoSize > 2 )
Camera.main.orthographicSize -= Time.deltaTime * cameraOrthoSize * ConfigSettings.MouseWheelSensitivity;
// Zoom out
if ( (Input.GetKey(KeyCode.DownArrow) || Input.GetAxis("MouseWheel") < 0) && Camera.main.orthographicSize < maxCameraOrthoSize )
Camera.main.orthographicSize += Time.deltaTime * cameraOrthoSize * ConfigSettings.MouseWheelSensitivity;
// DEBUG - RESTART LEVEL
if ( Input.GetKeyDown(KeyCode.Backspace) )
{
Application.LoadLevel(Application.loadedLevel);
}
}
void OnCollisionEnter(Collision collisionInfo)
{
collisionTime = Time.time;
float collisionMagnitude = collisionInfo.relativeVelocity.magnitude;
Debug.Log("Collision Magnitude: " + collisionMagnitude);
// Handle Structural Integrity
if ( collisionMagnitude > 0.8f )
{
float crashDamage = 5 * (collisionMagnitude - 0.8f);
structuralIntegrity -= crashDamage;
}
if ( collisionInfo.collider.tag == "Planet" )
{
bool syncOrbit;
bool syncRevolve;
try
{
// Get planet's orbital rotation speed
RotateObject rotationScript = collisionInfo.collider.gameObject.transform.parent .GetComponent<RotateObject>();
planetOrbitSpeed = rotationScript.speed;
syncOrbit = true;
}
catch ( NullReferenceException )
{
Debug.Log("Error Getting Orbital Speed: Planet does not orbit");
syncOrbit = false;
}
try
{
// Get speed that planet rotates on it's axis
RotateObject rotationScript = collisionInfo.collider.gameObject.GetComponent<RotateObject>();
planetSpinSpeed = rotationScript.speed;
syncRevolve = true;
}
catch ( NullReferenceException )
{
Debug.Log("Error Getting Revolution Speed: Planet does not revolve");
syncRevolve = false;
}
if ( syncOrbit == true || syncRevolve == true )
{
// Get Planet Position & Transform Data
Transform colliderTransform = collisionInfo.collider.transform;
activePlanet = colliderTransform;
prevPlanetPos = activePlanet.position;
curPlanetPos = activePlanet.position;
// Enable Player-Planet Position Synchronizing
isOnMovingPlanet = true;
}
}
}
void OnCollisionExit()
{
if ( isOnMovingPlanet == true )
{
// Disable Player-Planet Position Synchronizing
isOnMovingPlanet = false;
// Add Difference in Planet Velocity and Player Velocity
Vector3 planetVelocity = (curPlanetPos - prevPlanetPos) / Time.fixedDeltaTime;
Vector3 addVelocity = planetVelocity - rigidbodyVelocity;
rigidbody.velocity += addVelocity;
}
}
void FixedUpdate()
{
// Update velocity of player
rigidbodyVelocity = rigidbody.velocity;
float gravityForce;
float gravityConstant = 0.01f;
foreach ( CelestialObjects spaceObj in SpaceObjects )
{
if ( spaceObj.mass > 0 )
{
// Calculate the direction of gravity
Vector3 gravityVector = rigidbody.position - spaceObj.celestialObject.position;
// Calculate distance to planet's center of gravity
float distance = gravityVector.magnitude;
// Normalize the gravity vector
gravityVector = gravityVector / distance;
// Calculate gravitational force
gravityForce = (-gravityConstant * rigidbody.mass * spaceObj.mass) / (distance * distance);
// Apply gravitational force
rigidbody.AddForce(gravityVector * gravityForce);
}
}
//================================================== =====================================//
if ( isOnMovingPlanet == true )
{
// Update planet positions
prevPlanetPos = curPlanetPos;
curPlanetPos = activePlanet.position;
SyncToPlanetMotion();
}
}
void SyncToPlanetMotion()
{
// Get Planet Move Distance
Vector3 planetMotion = curPlanetPos - prevPlanetPos;
if ( isOnMovingPlanet == true )
{
// Move player position
transform.position += planetMotion;
// Rotate Player
transform.RotateAround(activePlanet.position, Vector3.forward, planetOrbitSpeed * Time.fixedDeltaTime);
transform.RotateAround(activePlanet.position, Vector3.forward, planetSpinSpeed * Time.fixedDeltaTime);
}
}
void OnParticleCollision()
{
// Apply random damage if player flies through volcano
float particleDamage = UnityEngine.Random.Range(0.1f, 0.5f);
structuralIntegrity -= particleDamage;
}
public IEnumerator KillLander()
{
PlayerData.HasLost = true;
LanderMesh.SetActive(false);
engineParticles.particleSystem.Stop();
rigidbody.constraints = RigidbodyConstraints.FreezeAll;
if ( hasCalledExplode == false )
{
hasCalledExplode = true;
landerExplosion.particleSystem.Play();
yield return new WaitForSeconds(3);
landerExplosion.particleSystem.Stop();
}
}
}
[/code]
Any unrelated tips or suggestions on coding techniques/methods?[/QUOTE]
You can try adding some print messages in OnCollisionEnter and OnCollisionExit to see when they're called.
Suggestion:
You don't need the planet rotation when you accelerate, right?
You can then try to delete OnCollisionExit and set isOnMovingPlanet to false in the accelerate key's function like I suggested last post.
[code]
void Update () {
if(Input.GetKey("insert acceleration key here")) {
isOnMovingPlanet = false;
// Insert velocity changes from OnCollisionExit here
}
}[/code]
If you're able to accelerate while the OnCollisionEnter function is still true, inserting isOnMovingPlanet = true in OnCollisionStay might help (or make it worse).
Now I'm trying to find workarounds, and there might be better ways to do it but that is what I can come up with right now given the current information and time usage. If you are willing, try it and feedback.
I'm finally doing something!
[unity]https://dl.dropboxusercontent.com/s/monaqdd99l0inbk/Desktop.unity3d?dl=1&token_hash=AAGGSX9wG_uGX_ikJSuX5XLyUgKRoJTZB3CesToAmt6Brg[/unity]
Use WASD or the arrow keys to move.
Spacebar to jump, and k to dash
Using this font [url]http://fontawesome.io/cheatsheet/[/url] with dfGUI's dynamic font system gives you a ton of useful vector icons to use.. it's quite pleasing :)
I am loving daikon forge so much more than NGUI at the moment, can build a menu system really easily and don't have to mess around with anchors as much for scaling.
Another asset I've just started using is SoundManagerPro, great and easy pooling system for Music or SFX, really easy to get sound incorporated with very little scripting needed. There's a free version to try it on the appstore, full version is about $15 (mainly removes watermark). I'd recommend giving the free version a try. Free version: [url]https://www.assetstore.unity3d.com/#/content/9582[/url]
[editline]9th November 2013[/editline]
New Gameplay upload, bit larger in size this time:
[unity]https://dl.dropboxusercontent.com/u/10044881/Ludicrous%20Speed/Ludicrous%20Speed%20PreAlpha%201/Ludicrous%20Speed%20PreAlpha%201.unity3d[/unity]
And video:
[video=youtube;wrHMktN3vls]http://www.youtube.com/watch?v=wrHMktN3vls[/video]
Wow, daikon forge really brought something to your game.
Also I had unity crash when clicking main menu after finishing a track.
[QUOTE=Brandy92;42807203]Wow, daikon forge really brought something to your game.
Also I had unity crash when clicking main menu after finishing a track.[/QUOTE]
Hmm, didn't do that for me but I have had some weird crashes, and it seems to be related to daikon forge. I've had disabled panels that when clicked on cause crashes, not sure if it's something to do with the 'Interactive' option.
Actually, I think it had to do with my screenshot saving script, I forgot to add a check to see if the game was running in webplayer as it uses System.IO
Alright, so opinion people. The problem I had with the previous way the world curves is that as the game gets faster, it gets harder to know what is coming. I had the thought of either going for a marker that generates before the object shows up, or changing the view. So I tried this new view which allows me to set the level generation so you can go faster and still see what's coming up.
[t]https://dl.dropboxusercontent.com/u/10044881/Ludicrous%20Speed/testviewSS.png[/t]
I haven't move the gui / backdrop so I know about the problem of them being there. And for aesthetic, the sunset backdrop won't be the only one, planning a few different map styles. Let me know if you think this looks better.
[QUOTE=Huacati;42807955][
[t]https://dl.dropboxusercontent.com/u/10044881/Ludicrous%20Speed/testviewSS.png[/t]
I haven't move the gui / backdrop so I know about the problem of them being there. And for aesthetic, the sunset backdrop won't be the only one, planning a few different map styles. Let me know if you think this looks better.[/QUOTE]
Much better, but the perpetual left turn is strange if the background doesn't move.
Maybe you could make it like these old racing games with gentle turns that push you towards on side of the road once in a while.
[QUOTE=Tamschi;42809311]Much better, but the perpetual left turn is strange if the background doesn't move.
Maybe you could make it like these old racing games with gentle turns that push you towards on side of the road once in a while.[/QUOTE]
The background kinda moves, all rigged to move left or right with the sun continually going down, can increase the speed on all of them though. Each background piece is it's own object, so can have them do what they want.
If I keep it this way I will eventually have the curve change, it's just tricky as the road and every object is using a shader that makes it look curved, everything is technically sitting on a y plane of 0. Other possibility is I just have the road going dead straight but still curved up, and still have the background move.
Spent all day texturing a planet model a made a while back. First time texturing a model.
[video=youtube;AUI6HlioOpg]http://www.youtube.com/watch?v=AUI6HlioOpg[/video]
I also made a [url=https://dl.dropboxusercontent.com/u/13781308/Boxart%20Mockup.png]mock-up of box art[/url] for the game. Any ideas for a name that isn't shit?
[editline]9th November 2013[/editline]
[t]https://dl.dropboxusercontent.com/u/13781308/Protoplanet.jpg[/t]
That looks amazing dude
[QUOTE=Pelf;42814380]Spent all day texturing a planet model a made a while back. First time texturing a model.
[video=youtube;AUI6HlioOpg]http://www.youtube.com/watch?v=AUI6HlioOpg[/video]
I also made a [url=https://dl.dropboxusercontent.com/u/13781308/Boxart%20Mockup.png]mock-up of box art[/url] for the game. Any ideas for a name that isn't shit?
[editline]9th November 2013[/editline]
[t]https://dl.dropboxusercontent.com/u/13781308/Protoplanet.jpg[/t][/QUOTE]
I wouldn't want to orbit a planet like that, the gravity shifting must be hell :v:
Anyways awesome work and did you fix the stuttering problem?
[QUOTE=Fixed;42817722]I wouldn't want to orbit a planet like that, the gravity shifting must be hell :v:
Anyways awesome work and did you fix the stuttering problem?[/QUOTE]It could also be that the planet or moon has low enough gravity so that it doesn't even out into a sphere.
[QUOTE=Fixed;42817722]I wouldn't want to orbit a planet like that, the gravity shifting must be hell :v:
Anyways awesome work and did you fix the stuttering problem?[/QUOTE]
Just finished implementing your suggestion on the last page and it fixes some of the problems like the sticky planets and the liftoff velocity stutter. But I'm still having problems with planets orbiting another moving planet. I've been giving some thought to using reference frames and getting rid of having to land on moving planets altogether; that is, the game will freeze the planet with the highest gravitational pull (or the closest planet) and move everything else in the scene around it.
[QUOTE=Pelf;42818734]I've been giving some thought to using reference frames and getting rid of having to land on moving planets altogether; that is, the game will freeze the planet with the highest gravitational pull (or the closest planet) and move everything else in the scene around it.[/QUOTE]
As far as I know, this is by far the best way to do it.
Finally I abandoned the boring default night skybox in Unity, and made this one:
[img]http://farm6.staticflickr.com/5530/10785250756_71dbb395ba_o.png[/img]
What do you think?
[QUOTE=Fixed;42821286]Finally I abandoned the boring default night skybox in Unity, and made this one:
[img]http://pulsar-regions.com/apps/projectmoon/pic/skybox.png[/img]
What do you think?[/QUOTE]
That skybox looks really nice. Is there a sun? Because now the lighting of the landscape looks odd.
[QUOTE=NightmareX91;42821299]That skybox looks really nice. Is there a sun? Because now the lighting of the landscape looks odd.[/QUOTE]
No sun yet, but I'm gonna work on that.
Also I tried to resize Earth a little bit, but it ended up looking square-ish, but what do you say is it too big?
[QUOTE=Fixed;42821350]No sun yet, but I'm gonna work on that.
Also I tried to resize Earth a little bit, but it ended up looking square-ish, but what do you say is it too big?[/QUOTE]
It looks okay to me.
[QUOTE=Fixed;42821350]No sun yet, but I'm gonna work on that.
Also I tried to resize Earth a little bit, but it ended up looking square-ish, but what do you say is it too big?[/QUOTE]
[URL="https://www.youtube.com/watch?v=XELfhVVVkmg&hd=1"]Unless your FOV is very small the Earth is HUGE in your screenshot.[/URL]
[QUOTE=Tamschi;42821468][URL="https://www.youtube.com/watch?v=XELfhVVVkmg&hd=1"]Unless your FOV is very small the Earth is HUGE in your screenshot.[/URL][/QUOTE]
I know, what about this one:
[img]http://farm4.staticflickr.com/3718/10785342054_dc8bf4a728_o.png[/img]
[QUOTE=Fixed;42821652]I know, what about this one:
[img]http://farm4.staticflickr.com/3718/10785342054_dc8bf4a728_o.png[/img][/QUOTE]make it 65% and it'll be awesome I think
Sorry, you need to Log In to post a reply to this thread.