- Home /
AABB Error, attached Log fragments.
Quaternion To Matrix conversion failed because input Quaternion is invalid {1.#QNAN0, 1.#QNAN0, 1.#QNAN0, 1.#QNAN0} l=1.#QNAN0
(Filename: C:/buildslave/unity/build/Runtime/Math/Quaternion.cpp Line: 188)
Quaternion To Matrix conversion failed because input Quaternion is invalid {1.#QNAN0, 1.#QNAN0, 1.#QNAN0, 1.#QNAN0} l=1.#QNAN0
(Filename: C:/buildslave/unity/build/Runtime/Math/Quaternion.cpp Line: 148)
Invalid AABB result
(Filename: C:/buildslave/unity/build/Runtime/Geometry/AABB.cpp Line: 181)
Quaternion To Matrix conversion failed because input Quaternion is invalid {1.#QNAN0, 1.#QNAN0, 1.#QNAN0, 1.#QNAN0} l=1.#QNAN0
(Filename: C:/buildslave/unity/build/Runtime/Math/Quaternion.cpp Line: 188)
Quaternion To Matrix conversion failed because input Quaternion is invalid {1.#QNAN0, 1.#QNAN0, 1.#QNAN0, 1.#QNAN0} l=1.#QNAN0
(Filename: C:/buildslave/unity/build/Runtime/Math/Quaternion.cpp Line: 148)
Quaternion To Matrix conversion failed because input Quaternion is invalid {-1.#IND00, -1.#IND00, -1.#IND00, 1.#QNAN0} l=-1.#IND00
(Filename: C:/buildslave/unity/build/Runtime/Math/Quaternion.cpp Line: 188)
Quaternion To Matrix conversion failed because input Quaternion is invalid {-1.#IND00, 1.#QNAN0, 1.#QNAN0, 1.#QNAN0} l=1.#QNAN0
(Filename: C:/buildslave/unity/build/Runtime/Math/Quaternion.cpp Line: 188)
Quaternion To Matrix conversion failed because input Quaternion is invalid {-1.#IND00, -1.#IND00, -1.#IND00, -1.#IND00} l=-1.#IND00
(Filename: C:/buildslave/unity/build/Runtime/Math/Quaternion.cpp Line: 188)
Quaternion To Matrix conversion failed because input Quaternion is invalid {-1.#IND00, -1.#IND00, -1.#IND00, -1.#IND00} l=-1.#IND00
(Filename: C:/buildslave/unity/build/Runtime/Math/Quaternion.cpp Line: 188)
Quaternion To Matrix conversion failed because input Quaternion is invalid {-1.#IND00, -1.#IND00, -1.#IND00, -1.#IND00} l=-1.#IND00
(Filename: C:/buildslave/unity/build/Runtime/Math/Quaternion.cpp Line: 188)
Quaternion To Matrix conversion failed because input Quaternion is invalid {-1.#IND00, -1.#IND00, -1.#IND00, -1.#IND00} l=-1.#IND00
(Filename: C:/buildslave/unity/build/Runtime/Math/Quaternion.cpp Line: 188)
Quaternion To Matrix conversion failed because input Quaternion is invalid {-1.#IND00, -1.#IND00, -1.#IND00, -1.#IND00} l=-1.#IND00
(Filename: C:/buildslave/unity/build/Runtime/Math/Quaternion.cpp Line: 188)
Invalid AABB aabb UnityEditorInternal.InternalEditorUtility:CalculateSelectionBounds(Boolean, Boolean) UnityEditor.Tools:GetHandlePosition() (at C:\buildslave\unity\build\artifacts\generated\common\editor\ToolsBindings.gen.cs:169) UnityEditor.Tools:get_handlePosition() (at C:\buildslave\unity\build\artifacts\generated\common\editor\ToolsBindings.gen.cs:150) UnityEditor.ManipulationTool:OnToolGUI(SceneView) (at C:\buildslave\unity\build\Editor\Mono\GUI\Tools\BuiltinTools.cs:17) UnityEditor.MoveTool:OnGUI(SceneView) (at C:\buildslave\unity\build\Editor\Mono\GUI\Tools\BuiltinTools.cs:82) UnityEditor.SceneView:DefaultHandles() (at C:\buildslave\unity\build\Editor\Mono\SceneView\SceneView.cs:1678) UnityEditor.SceneView:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\SceneView\SceneView.cs:1206) System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&) System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222) System.Reflection.MethodBase:Invoke(Object, Object[]) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115) UnityEditor.HostView:Invoke(String, Object) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:185) UnityEditor.HostView:Invoke(String) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:178) UnityEditor.DockArea:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:334)
[C:\buildslave\unity\build\Runtime/Geometry/AABB.h line 171] (Filename: /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs Line: 222)
Invalid AABB result UnityEditorInternal.InternalEditorUtility:CalculateSelectionBounds(Boolean, Boolean) UnityEditor.Tools:GetHandlePosition() (at C:\buildslave\unity\build\artifacts\generated\common\editor\ToolsBindings.gen.cs:169) UnityEditor.Tools:get_handlePosition() (at C:\buildslave\unity\build\artifacts\generated\common\editor\ToolsBindings.gen.cs:150) UnityEditor.ManipulationTool:OnToolGUI(SceneView) (at C:\buildslave\unity\build\Editor\Mono\GUI\Tools\BuiltinTools.cs:17) UnityEditor.MoveTool:OnGUI(SceneView) (at C:\buildslave\unity\build\Editor\Mono\GUI\Tools\BuiltinTools.cs:82) UnityEditor.SceneView:DefaultHandles() (at C:\buildslave\unity\build\Editor\Mono\SceneView\SceneView.cs:1678) UnityEditor.SceneView:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\SceneView\SceneView.cs:1206) System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&) System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222) System.Reflection.MethodBase:Invoke(Object, Object[]) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115) UnityEditor.HostView:Invoke(String, Object) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:185) UnityEditor.HostView:Invoke(String) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:178) UnityEditor.DockArea:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:334)
[C:/buildslave/unity/build/Runtime/Geometry/AABB.cpp line 192] (Filename: /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs Line: 222)
Invalid AABB aabb UnityEditorInternal.InternalEditorUtility:CalculateSelectionBounds(Boolean, Boolean) UnityEditor.Tools:GetHandlePosition() (at C:\buildslave\unity\build\artifacts\generated\common\editor\ToolsBindings.gen.cs:169) UnityEditor.Tools:get_handlePosition() (at C:\buildslave\unity\build\artifacts\generated\common\editor\ToolsBindings.gen.cs:150) UnityEditor.ManipulationTool:OnToolGUI(SceneView) (at C:\buildslave\unity\build\Editor\Mono\GUI\Tools\BuiltinTools.cs:17) UnityEditor.MoveTool:OnGUI(SceneView) (at C:\buildslave\unity\build\Editor\Mono\GUI\Tools\BuiltinTools.cs:82) UnityEditor.SceneView:DefaultHandles() (at C:\buildslave\unity\build\Editor\Mono\SceneView\SceneView.cs:1678) UnityEditor.SceneView:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\SceneView\SceneView.cs:1206) System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&) System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222) System.Reflection.MethodBase:Invoke(Object, Object[]) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115) UnityEditor.HostView:Invoke(String, Object) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:185) UnityEditor.HostView:Invoke(String) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:178) UnityEditor.DockArea:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:334)
[C:\buildslave\unity\build\Runtime/Geometry/AABB.h line 171] (Filename: /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs Line: 222)
Invalid AABB aabb UnityEditorInternal.InternalEditorUtility:CalculateSelectionBounds(Boolean, Boolean) UnityEditor.Tools:GetHandlePosition() (at C:\buildslave\unity\build\artifacts\generated\common\editor\ToolsBindings.gen.cs:169) UnityEditor.Tools:get_handlePosition() (at C:\buildslave\unity\build\artifacts\generated\common\editor\ToolsBindings.gen.cs:150) UnityEditor.ManipulationTool:OnToolGUI(SceneView) (at C:\buildslave\unity\build\Editor\Mono\GUI\Tools\BuiltinTools.cs:17) UnityEditor.MoveTool:OnGUI(SceneView) (at C:\buildslave\unity\build\Editor\Mono\GUI\Tools\BuiltinTools.cs:82) UnityEditor.SceneView:DefaultHandles() (at C:\buildslave\unity\build\Editor\Mono\SceneView\SceneView.cs:1678) UnityEditor.SceneView:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\SceneView\SceneView.cs:1206) System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&) System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222) System.Reflection.MethodBase:Invoke(Object, Object[]) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115) UnityEditor.HostView:Invoke(String, Object) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:185) UnityEditor.HostView:Invoke(String) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:178) UnityEditor.DockArea:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\GUI\DockArea.cs:334)
[C:\buildslave\unity\build\Runtime/Geometry/AABB.h line 171] (Filename: /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs Line: 222)
using UnityEngine;
using System.Collections;
public class ThirdPCameraController : MonoBehaviour
{
public GameObject Player;
public float Shiftspeed = 0;
Transform Defaultcampos;
Transform Backwardcampos;
Transform Leftturncampos;
Transform Rightturncampos;
Transform Jumpcampos;
Transform Orbitcampos;
Transform Uncontrollablecampos;
bool Quickshift = false;
// Use this for initialization
void Start()
{
Defaultcampos = GameObject.Find("Defaultcampos").transform;
if (GameObject.Find("Backwardcampos"))
{
Backwardcampos = GameObject.Find("Backwardcampos").transform;
}
if (GameObject.Find("Leftturncampos"))
{
Leftturncampos = GameObject.Find("Leftturncampos").transform;
}
if (GameObject.Find("Rightturncampos"))
{
Rightturncampos = GameObject.Find("Rightturncampos").transform;
}
if (GameObject.Find("Jumpcampos"))
{
Jumpcampos = GameObject.Find("Jumpcampos").transform;
}
if (GameObject.Find("Orbitcampos"))
{
Orbitcampos = GameObject.Find("Orbitcampos").transform;
}
if (GameObject.Find("Uncontrollablecampos"))
{
Uncontrollablecampos = GameObject.Find("Uncontrollablecampos").transform;
}
transform.position = Defaultcampos.position;
transform.forward = Defaultcampos.forward;
}
void FixedUpdate()
{
if (Input.GetAxis("Vertical") > 0 && Player.GetComponent<UnitychanController>().Anim.GetBool("Jumpcam") && Player.GetComponent<UnitychanController>().Controllable)
{
SettoJump();
}
else if (Input.GetAxis("Vertical") < 0 && !Player.GetComponent<UnitychanController>().Anim.GetBool("Sprint") && Player.GetComponent<UnitychanController>().Controllable)
{
SettoBackward();
}
else if (Input.GetAxis("Horizontal") < 0 && !Player.GetComponent<UnitychanController>().Anim.GetBool("Sprint") && Player.GetComponent<UnitychanController>().Controllable)
{
SettoLeftturn();
}
else if (Input.GetAxis("Horizontal") > 0 && !Player.GetComponent<UnitychanController>().Anim.GetBool("Sprint") && Player.GetComponent<UnitychanController>().Controllable)
{
SettoRightturn();
}
else if (Player.GetComponent<UnitychanController>().Idling && Player.GetComponent<UnitychanController>().Controllable)
{
SettoOrbit();
}
else if (!Player.GetComponent<UnitychanController>().Controllable)
{
SettoUncontrollable();
}
else
{
SettoDefault();
}
}
void SettoDefault()
{
if (Quickshift == false)
{
transform.position = Vector3.Lerp(transform.position, Defaultcampos.position, Time.fixedDeltaTime * Shiftspeed);
transform.forward = Vector3.Lerp(transform.forward, Defaultcampos.forward, Time.fixedDeltaTime * Shiftspeed);
}
else
{
transform.position = Defaultcampos.position;
transform.forward = Defaultcampos.forward;
Quickshift = false;
}
}
void SettoBackward()
{
Quickshift = true;
transform.position = Backwardcampos.position;
transform.forward = Backwardcampos.forward;
}
void SettoLeftturn()
{
Quickshift = false;
transform.position = Vector3.Lerp(transform.position, Leftturncampos.position, Time.fixedDeltaTime * Shiftspeed);
transform.forward = Vector3.Lerp(transform.forward, Leftturncampos.forward, Time.fixedDeltaTime * Shiftspeed);
}
void SettoRightturn()
{
Quickshift = false;
transform.position = Vector3.Lerp(transform.position, Rightturncampos.position, Time.fixedDeltaTime * Shiftspeed);
transform.forward = Vector3.Lerp(transform.forward, Rightturncampos.forward, Time.fixedDeltaTime * Shiftspeed);
}
void SettoJump()
{
Quickshift = false;
transform.position = Vector3.Lerp(transform.position, Jumpcampos.position, Time.fixedDeltaTime * Shiftspeed);
transform.forward = Vector3.Lerp(transform.forward, Jumpcampos.forward, Time.fixedDeltaTime * Shiftspeed);
}
void SettoOrbit()
{
Quickshift = false;
transform.position = Vector3.Lerp(transform.position, Orbitcampos.position, Time.fixedDeltaTime * Shiftspeed);
transform.forward = Vector3.Lerp(transform.forward, Orbitcampos.forward, Time.fixedDeltaTime * Shiftspeed);
}
void SettoUncontrollable()
{
Quickshift = true;
transform.position = Uncontrollablecampos.position;
transform.forward = Uncontrollablecampos.forward;
}
}
using UnityEngine;
using System.Collections;
public class UnitychanController : MonoBehaviour
{
public Animator Anim = null;
public AnimatorStateInfo currentBaseState;
public float Speed = 0;
public float DirectionX = 0;
public float DirectionY = 0;
public float Maxstamina = 0;
public float Stamina = 0;
public float Jumppower = 0;
public float Fallvel = 0;
public float Idlechangerate = 0;
public float framecount = 0;
public float falltimer = 0;
public float angle = 0;
public float boostbylongrun = 1;
public bool Idling = false;
public bool Controllable = false;
public bool Startflag = false;
public bool Goalflag = false;
public bool Gameover = false;
public bool Sprint = false;
public bool Sprintlimit = false;
public AudioClip[] SFXList = null;
static int idleState = Animator.StringToHash("Base Layer.Idle00");
static int idle1State = Animator.StringToHash("Base Layer.Idle01");
static int idle2State = Animator.StringToHash("Base Layer.Idle02");
static int idle3State = Animator.StringToHash("Base Layer.Idle03");
static int idle4State = Animator.StringToHash("Base Layer.Idle04");
static int locoState = Animator.StringToHash("Base Layer.Locomotion");
static int sprintState = Animator.StringToHash("Base Layer.Sprint");
static int jumpstartState = Animator.StringToHash("Base Layer.Jumpstart");
static int jumpState = Animator.StringToHash("Base Layer.Jump");
static int fallState = Animator.StringToHash("Base Layer.Fall");
static int landState = Animator.StringToHash("Base Layer.Landingmotion");
AudioSource SFX = null;
// Use this for initialization
void Start()
{
SFX = GetComponent<AudioSource>();
StartCoroutine(IdleChanger(Idlechangerate));
Anim.SetFloat("Jumppower", Jumppower);
Stamina = Maxstamina;
}
void FixedUpdate()
{
Anim.SetFloat("DirectionX", DirectionX);
Anim.SetFloat("DirectionY", DirectionY);
Anim.SetFloat("Speed", boostbylongrun / 2f);
Fallvel = GetComponent<Rigidbody>().velocity.y;
if (currentBaseState.fullPathHash == idleState || currentBaseState.fullPathHash == locoState || currentBaseState.fullPathHash == sprintState)
{
Anim.SetFloat("Fallvel", 0);
}
if (Controllable && currentBaseState.fullPathHash != sprintState && Stamina < Maxstamina)
{
Stamina += (Maxstamina / 10) * Time.fixedDeltaTime;
}
if (Sprintlimit && Stamina > 36)
{
Sprintlimit = false;
}
if (Stamina > 0 && Sprint && currentBaseState.fullPathHash == sprintState)
{
Stamina -= 25 * Time.fixedDeltaTime;
}
else if (Stamina <= 0)
{
Stamina = 0;
Sprintlimit = true;
}
}
// Update is called once per frame
void Update()
{
currentBaseState = Anim.GetCurrentAnimatorStateInfo(0);
if (!Anim.GetBool("Land"))
{
Anim.SetFloat("Fallvel", Fallvel);
if (Anim.GetFloat("Fallvel") < 0)
{
Anim.SetBool("Jumpcam", false);
}
}
if (!(currentBaseState.fullPathHash == idleState || currentBaseState.fullPathHash == idle1State || currentBaseState.fullPathHash == idle2State || currentBaseState.fullPathHash == idle3State || currentBaseState.fullPathHash == idle4State))
{
Idling = false;
}
if (Gameover)
{
Controllable = false;
}
}
void OnCollisionEnter(Collision coll)
{
if (coll.collider.tag == "Platform" || coll.collider.tag == "Gameover")
{
Anim.SetBool("Land", true);
Anim.SetBool("Jumpcam", false);
framecount = 0;
falltimer = 0;
if (currentBaseState.fullPathHash == landState)
{
Anim.SetFloat("Jumppower", Jumppower);
Anim.SetBool("Jumpcam", false);
}
if (coll.collider.tag == "Gameover")
{
Gameover = true;
Anim.Play("LOSE00");
}
}
if (coll.collider.tag == "Goalline" && Startflag && !Goalflag && !Idling)
{
Goalflag = true;
Controllable = false;
Anim.Play("REFRESH00");
}
}
public void Stepsounds()
{
SFX.PlayOneShot(SFXList[0], 1);
}
public void Landsounds()
{
if (Fallvel<-5)
{
SFX.PlayOneShot(SFXList[1], 1);
}
else
{
SFX.PlayOneShot(SFXList[0], 1);
}
}
public void Jumpsounds()
{
SFX.PlayOneShot(SFXList[3], 1);
}
public void Sprintsounds()
{
SFX.PlayOneShot(SFXList[4], 1);
}
public IEnumerator IdleChanger(float rate)
{
float timer = 0;
while (!Gameover && !Goalflag)
{
if (currentBaseState.fullPathHash == idleState && !Anim.GetBool("Move") && !Anim.GetBool("Turn"))
{
timer += Time.deltaTime;
if (timer > rate)
{
Idling = true;
Anim.Play("Idle0" + Random.Range(1, 4 + 1));
timer = 0;
}
}
yield return new WaitForEndOfFrame();
}
yield return null;
}
public IEnumerator Jumpsystem()
{
while (Controllable && Startflag)
{
if (Input.GetKey(KeyCode.Space) && Anim.GetBool("Land") == true && (currentBaseState.fullPathHash != jumpstartState || currentBaseState.fullPathHash != jumpState || currentBaseState.fullPathHash != fallState || currentBaseState.fullPathHash != landState) && framecount == 0)
{
Anim.SetTrigger("Jump");
Anim.SetBool("Jumpcam", true);
}
if (currentBaseState.fullPathHash == jumpState)
{
if (framecount < 1)
{
Fallvel = 0;
Anim.SetFloat("Fallvel", 0);
Anim.ResetTrigger("Jump");
if (DirectionY < 0)
{
GetComponent<Rigidbody>().AddRelativeForce(new Vector3(0, Jumppower, Speed * DirectionY));
Anim.SetFloat("Jumppower", Jumppower);
}
else
{
GetComponent<Rigidbody>().AddRelativeForce(new Vector3(0, Jumppower * (1 + (DirectionY * boostbylongrun)), Speed * DirectionY * boostbylongrun));
Anim.SetFloat("Jumppower", Jumppower * (1f + (DirectionY * boostbylongrun) / 2));
}
Anim.SetBool("Land", false);
framecount += 1;
yield return new WaitForEndOfFrame();
}
}
yield return new WaitForEndOfFrame();
}
yield return null;
}
public IEnumerator Movesystem()
{
while (Controllable && Startflag)
{
DirectionX = Input.GetAxis("Horizontal");
DirectionY = Input.GetAxis("Vertical");
if (Input.GetKey(KeyCode.LeftShift) && DirectionY > 0 && !Sprintlimit)
{
if(!Sprint && currentBaseState.fullPathHash != sprintState){
if(currentBaseState.fullPathHash != jumpstartState){
Anim.Play("Sprint");
}
Sprintsounds();
if(Stamina >= 10f){
GetComponent<Rigidbody>().AddRelativeForce(new Vector3(0, 0, (Speed * Jumppower * boostbylongrun)/10));
boostbylongrun = 2f;
Stamina -= 10;
}
}
Sprint = true;
Anim.SetBool("Sprint", true);
if (boostbylongrun < 2f)
{
boostbylongrun += (Time.deltaTime * DirectionY);
}
else
{
boostbylongrun = 2f;
}
}
else
{
Sprint = false;
Anim.SetBool("Sprint", false);
}
if (DirectionX != 0)
{
Anim.SetBool("Turn", true);
}
else
{
Anim.SetBool("Turn", false);
}
if (DirectionY != 0)
{
Anim.SetBool("Move", true);
if (!Sprint)
{
if (boostbylongrun > 1f)
{
boostbylongrun -= (Time.deltaTime);
}
else
{
boostbylongrun = 1f;
}
}
}
else
{
Anim.SetBool("Move", false);
if (!Sprint)
{
if (boostbylongrun > 1f)
{
boostbylongrun -= (Time.deltaTime);
}
else
{
boostbylongrun = 1f;
}
}
}
if (DirectionY < 0 && currentBaseState.fullPathHash == locoState)
{
if (GetComponent<Rigidbody>().velocity.magnitude < 1 * -DirectionY)
{
GetComponent<Rigidbody>().AddRelativeForce(new Vector3(0, 0, Speed * DirectionY));
}
}
else if (DirectionY > 0 && currentBaseState.fullPathHash == locoState)
{
if (GetComponent<Rigidbody>().velocity.magnitude < 10f * DirectionY)
{
GetComponent<Rigidbody>().AddRelativeForce(new Vector3(0, 0, Speed * DirectionY));
}
}
else if (DirectionY > 0 && currentBaseState.fullPathHash == sprintState)
{
if (GetComponent<Rigidbody>().velocity.magnitude < 10f * DirectionY * boostbylongrun)
{
GetComponent<Rigidbody>().AddRelativeForce(new Vector3(0, 0, Speed * DirectionY * boostbylongrun));
}
}
if (DirectionX != 0 && currentBaseState.fullPathHash != landState && currentBaseState.fullPathHash != sprintState)
{
angle = DirectionX * 1.5f;
}
else if (currentBaseState.fullPathHash == sprintState)
{
angle = DirectionX / 4;
}
this.transform.Rotate(new Vector3(0, angle, 0));
yield return new WaitForEndOfFrame();
}
yield return null;
}
public IEnumerator Fallcheck()
{
while (Controllable && Startflag)
{
if (Anim.GetBool("Land") && Fallvel < -1.5f)
{
falltimer += Time.deltaTime;
if (falltimer > 0.25f)
{
Anim.SetBool("Land", false);
}
}
else
{
falltimer = 0;
}
if (!Anim.GetBool("Land") && Fallvel < -5 && Anim.GetFloat("Jumppower") < Jumppower)
{
Anim.SetFloat("Jumppower", Jumppower * (-Fallvel / 10 + 1));
if (Jumppower * (-Fallvel / 10) > Jumppower)
{
Anim.SetFloat("Jumppower", Jumppower * 2f);
}
}
yield return new WaitForEndOfFrame();
}
yield return null;
}
}
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class GameManagerScript : MonoBehaviour
{
public Image Effect = null;
public GameObject Panel = null;
public GameObject ReadyAndGo = null;
public GameObject Successstamp = null;
public GameObject Failstamp = null;
public GameObject Retrybutton = null;
public GameObject Titlebutton = null;
public GameObject Player = null;
public GameObject Timer = null;
public GameObject Rank = null;
public GameObject Speedgauge = null;
public UIBarScript Speedgaugesystem = null;
public GameObject Staminagauge = null;
public UIBarScript Staminagaugesystem = null;
public float Times = 0;
public AudioClip[] BGMList = null;
public AudioSource BGM = null;
public AudioClip[] SFXList = null;
public AudioSource SFX = null;
bool Result = false;
float magnitude = 0;
float scale = 0;
float rotate = 0;
Color color;
public void Title()
{
StartCoroutine(ToTitle());
}
public void Retry()
{
StartCoroutine(ToRetry());
}
// Use this for initialization
void Start()
{
Player.GetComponent<UnitychanController>().Controllable = false;
Player.GetComponent<UnitychanController>().Idling = true;
StartCoroutine(Startup());
}
// Update is called once per frame
void Update()
{
if (Player.GetComponent<UnitychanController>().Startflag && !Player.GetComponent<UnitychanController>().Goalflag && !Player.GetComponent<UnitychanController>().Gameover)
{
Speedgauge.SetActive(true);
Staminagauge.SetActive(true);
magnitude = Player.GetComponent<Rigidbody>().velocity.magnitude * 10;
int Stamina = (int)Player.GetComponent<UnitychanController>().Stamina;
int Maxstamina = (int)Player.GetComponent<UnitychanController>().Maxstamina;
Speedgaugesystem.UpdateValue((int)magnitude, 200);
Staminagaugesystem.UpdateValue(Stamina, Maxstamina);
}
else
{
Speedgauge.SetActive(false);
Staminagauge.SetActive(false);
}
if (Player.GetComponent<UnitychanController>().Gameover || Player.GetComponent<UnitychanController>().Goalflag)
{
Retrybutton.SetActive(true);
Titlebutton.SetActive(true);
if (Player.GetComponent<UnitychanController>().Gameover)
{
Failstamp.SetActive(true);
}
else if (Player.GetComponent<UnitychanController>().Goalflag)
{
Successstamp.SetActive(true);
}
}
else
{
Retrybutton.SetActive(false);
Titlebutton.SetActive(false);
Successstamp.SetActive(false);
Failstamp.SetActive(false);
}
if (Player.GetComponent<UnitychanController>().Controllable)
{
if (magnitude > 100f)
{
color.a = magnitude/250;
}
else
{
if (scale > 2f)
{
color.a = 0;
}
}
if (scale > 2f)
{
scale = 0.25f;
}
scale += 0.05f + magnitude/2000;
rotate = magnitude/200;
Effect.color = color;
Effect.rectTransform.localScale = new Vector2(scale,scale);
Effect.rectTransform.Rotate(new Vector3(0,0,rotate));
}
else
{
color.a = 0;
Effect.color = color;
}
if (Player.GetComponent<UnitychanController>().Startflag && !Player.GetComponent<UnitychanController>().Goalflag && !Player.GetComponent<UnitychanController>().Gameover)
{
Timer.SetActive(true);
Rank.SetActive(false);
Timer.GetComponent<Text>().text = Times.ToString("F2") + "Sec";
Times += Time.deltaTime;
}
else if (Player.GetComponent<UnitychanController>().Goalflag || Player.GetComponent<UnitychanController>().Gameover)
{
Timer.GetComponent<Text>().text = Times.ToString("F2") + "Sec";
if (!Result)
{
StartCoroutine(Showresult());
Result = true;
}
}
}
IEnumerator ToTitle()
{
SFX.PlayOneShot(SFXList[3], 1);
yield return new WaitForSeconds(1.5f);
Application.LoadLevel("Title");
yield return null;
}
IEnumerator ToRetry()
{
SFX.PlayOneShot(SFXList[4], 1);
yield return new WaitForSeconds(1f);
Application.LoadLevel("Stage1");
yield return null;
}
IEnumerator Startup()
{
yield return new WaitForSeconds(1);
Panel.SetActive(true);
yield return new WaitForSeconds(3);
Panel.SetActive(false);
yield return new WaitForSeconds(1);
Player.GetComponent<UnitychanController>().Controllable = true;
Player.GetComponent<UnitychanController>().Idling = false;
ReadyAndGo.SetActive(true);
yield return new WaitForSeconds(0.55f);
SFX.PlayOneShot(SFXList[5], 1);
yield return new WaitForSeconds(1.7f);
SFX.PlayOneShot(SFXList[6], 1);
yield return new WaitForSeconds(0.5f);
Player.GetComponent<UnitychanController>().Idling = false;
Player.GetComponent<UnitychanController>().Startflag = true;
StartCoroutine(Player.GetComponent<UnitychanController>().Movesystem());
StartCoroutine(Player.GetComponent<UnitychanController>().IdleChanger(Player.GetComponent<UnitychanController>().Idlechangerate));
StartCoroutine(Player.GetComponent<UnitychanController>().Jumpsystem());
StartCoroutine(Player.GetComponent<UnitychanController>().Fallcheck());
BGM.clip = BGMList[0];
BGM.volume = 0.5f;
BGM.Play();
yield return new WaitForSeconds(0.25f);
ReadyAndGo.SetActive(false);
yield return null;
}
IEnumerator Showresult()
{
if (Player.GetComponent<UnitychanController>().Goalflag && !Player.GetComponent<UnitychanController>().Gameover)
{
Rank.SetActive(true);
if (Times < 240f)
{
Rank.GetComponent<Text>().text = "Your Rank is:<color=#e5e4e2ff>S!</color>";
}
else if (Times > 240f && Times < 360f)
{
Rank.GetComponent<Text>().text = "Your Rank is:<color=#DFC463ff>A</color>";
}
else if (Times > 360f && Times < 480f)
{
Rank.GetComponent<Text>().text = "Your Rank is:<color=#C0C0C0ff>B</color>";
}
else if (Times > 480f && Times < 600f)
{
Rank.GetComponent<Text>().text = "Your Rank is:<color=#CD7F32ff>C</color>";
}
else
{
Rank.GetComponent<Text>().text = "Your Rank is:<color=#ff0000ff>F!</color>";
}
BGM.Stop();
SFX.PlayOneShot(SFXList[0], 1);
SFX.PlayOneShot(SFXList[2], 1);
}
else if (Player.GetComponent<UnitychanController>().Gameover)
{
Rank.SetActive(true);
Rank.GetComponent<Text>().text = "Your Rank is:<color=#ff0000ff>F!</color>";
BGM.Stop();
SFX.PlayOneShot(SFXList[1], 1);
SFX.PlayOneShot(SFXList[2], 1);
}
yield return null;
}
}
how I can fix this problems? I can't understand why this error occurred; I just tried 3D character move forward fast and turn(rotate) the right(or left) fast with inertial, then this error occurred. I tried to check the character's rotation, UI Image rotation, and etc, but I can't understand. please help me...
Answer by VesuvianPrime · Aug 20, 2015 at 04:36 PM
You probably need to normalize your Quaternions:
/// <summary>
/// Returns a normalized copy of the quaternion.
/// </summary>
/// <param name="extends">Extends.</param>
public static Quaternion Normalized(this Quaternion extends)
{
float sum = 0.0f;
float x = extends.x;
float y = extends.y;
float z = extends.z;
float w = extends.w;
sum += x * x;
sum += y * y;
sum += z * z;
sum += w * w;
float magnitudeInverse = 1.0f / Mathf.Sqrt(sum);
x *= magnitudeInverse;
y *= magnitudeInverse;
z *= magnitudeInverse;
w *= magnitudeInverse;
return new Quaternion(x, y, z, w);
}
Oh, thanks. but [Extension methods must be defined in a non-generic static class] error occurred...
@VesuvianPrime:
That doesn't make much sense. Unity always use normalized (unit) quaternions and he doesn't seem to modify a quaternion directly somewhere in his code. Also it seems he gets a NaN value somewhere and that directly or indirectly gets into the quaternion which of course messes everything up.
Probably because of the "Lerping" of the forward axis. Using Slerp for direction vectors might help but it's way too less (useful) information to say anything specific.
btw: to calculate the magnitude of a quaternion all you have to do is this line:
float magnitude = $$anonymous$$athf.Sqrt(Quaternion.Dot(extends, extends));
So the extension method could be quite a bit simplified:
public static Quaternion Normalized(this Quaternion extends)
{
float a = 1f / $$anonymous$$athf.Sqrt(Quaternion.Dot(extends, extends));
extends.x *= a;
extends.y *= a;
extends.z *= a;
extends.w *= a;
return extends;
}
However, as i said i don't see how this method should help here and where he should actually use it...
thanks to your advice. but Slerp doesn't fix this...(test and freezing by mass of same errors)
@LucifelShiningL:
Sorry, but we can't really help you with this one. It seems you have quite a few scripts and you have no idea where your problem comes from. Debugging is up to you. Try disabling certain script and see if it still happens.
You also just roughly explained when it actually occurred. You have to narrow it down to what actions actually triggers it. If there's a $$anonymous$$imum / maximum movement speed. Can you reliably reproduce the problem? check the first console messages when the problem started. For this you have to disable the "collapse" button. See if you can figure out which script is causing the problem.
Apart from that do you already know which GameObject is the one that casues the problem? $$anonymous$$ost likely either your Player or "the / a" camera but it could be any object in your scene.