From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001
From: chai <chaifix@163.com>
Date: Wed, 14 Aug 2019 22:50:43 +0800
Subject: +Unity Runtime code

---
 Runtime/Dynamics/SphereCollider.h | 56 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 Runtime/Dynamics/SphereCollider.h

(limited to 'Runtime/Dynamics/SphereCollider.h')

diff --git a/Runtime/Dynamics/SphereCollider.h b/Runtime/Dynamics/SphereCollider.h
new file mode 100644
index 0000000..1a3f779
--- /dev/null
+++ b/Runtime/Dynamics/SphereCollider.h
@@ -0,0 +1,56 @@
+#ifndef SPHERECOLLIDER_H
+#define SPHERECOLLIDER_H
+
+#include "Collider.h"
+#include "Runtime/Math/Vector3.h"
+
+
+class SphereCollider : public Collider
+{
+ public:	
+	REGISTER_DERIVED_CLASS (SphereCollider, Collider)
+	DECLARE_OBJECT_SERIALIZE (SphereCollider)
+	
+	SphereCollider (MemLabelId label, ObjectCreationMode mode);
+	
+	virtual void Reset ();
+	virtual void SmartReset ();
+	virtual void AwakeFromLoad(AwakeFromLoadMode mode);
+	
+	void SetRadius (float r);
+	float GetRadius () const { return m_Radius; }
+
+	float GetScaledRadius () const;
+
+	void SetCenter (const Vector3f& center);
+	Vector3f GetCenter () { return m_Center; }
+
+	Vector3f GetGlobalCenter () const;
+
+	void TransformChanged (int changeMask);
+	
+	virtual AABB GetBounds ();
+	
+	protected:
+	
+	virtual void Create (const Rigidbody* ignoreAttachRigidbody);
+	virtual void FetchPoseFromTransform ();
+	virtual bool GetRelativeToParentPositionAndRotation (Transform& transform, Transform& anyParent, Matrix4x4f& matrix);
+
+	virtual NxCCDSkeleton* CreateCCDSkeleton(float scale);
+	
+	void ScaleChanged ();
+	
+	/// The radius of the sphere. range { 0.00001, infinity }
+	float m_Radius;
+	Vector3f m_Center;
+
+	#if UNITY_EDITOR
+	/// In unity version 1.0 sphere radius did not change with scale.
+	/// This was fixed with version 1.1
+	/// In the transfer function we check if we should up to account for the now introduced scale.
+	bool fixupSphereColliderBackwardsCompatibility;
+	#endif
+};
+
+#endif
-- 
cgit v1.1-26-g67d0