11 private const float DELTA_TIME_FACTOR = 10f;
25 if (tsCollider != null && tsCollider.
Body != null) {
34 if (tsCollider != null && tsCollider.
Body != null) {
52 if (tsCollider != null && tsCollider.
Body != null) {
61 if (tsCollider != null && tsCollider.
Body != null) {
86 private bool _serialized;
90 if (tsCollider != null) {
128 public void Translate(FP x, FP y, FP z, Space relativeTo) {
154 if (relativeTo == Space.Self) {
177 vector = point + vector2;
193 public void Rotate(FP xAngle, FP yAngle, FP zAngle) {
202 public void Rotate(FP xAngle, FP yAngle, FP zAngle, Space relativeTo) {
210 Rotate(eulerAngles, Space.Self);
217 Rotate(axis, angle, Space.Self);
228 if (relativeTo == Space.Self) {
246 if (relativeTo == Space.Self) {
298 private bool initialized =
false;
302 public void Start() {
303 if (!Application.isPlaying) {
308 rb = GetComponent<TSRigidBody> ();
319 tsCollider = GetComponent<TSCollider>();
320 if (transform.parent != null) {
321 tsParent = transform.parent.GetComponent<
TSTransform>();
328 if (tsCollider != null) {
334 StateTracker.AddTracking(
this);
340 public void Update() {
341 if (Application.isPlaying) {
350 private void UpdateEditMode() {
351 if (transform.hasChanged) {
352 _position = transform.position.ToTSVector();
353 _rotation = transform.rotation.ToTSQuaternion();
354 _scale = transform.localScale.ToTSVector();
360 private void UpdatePlayMode() {
363 transform.position = Vector3.Lerp(transform.position,
position.ToVector(), Time.deltaTime * DELTA_TIME_FACTOR);
364 transform.rotation = Quaternion.Lerp(transform.rotation,
rotation.ToQuaternion(), Time.deltaTime * DELTA_TIME_FACTOR);
365 transform.localScale = Vector3.Lerp(transform.localScale,
scale.ToVector(), Time.deltaTime * DELTA_TIME_FACTOR);
369 transform.rotation = Quaternion.Lerp(transform.rotation,
rotation.ToQuaternion(), Time.deltaTime * DELTA_TIME_FACTOR);
370 transform.localScale = Vector3.Lerp(transform.localScale,
scale.ToVector(), Time.deltaTime * DELTA_TIME_FACTOR);
375 transform.position =
position.ToVector();
376 transform.rotation =
rotation.ToQuaternion();
377 transform.localScale =
scale.ToVector();
TSVector TSPosition
Set/get body's position.
void Normalize()
Sets the length of the quaternion to one.
static TSMatrix AngleAxis(FP angle, TSVector axis)
Creates a matrix which rotates around the given axis by the given angle.
TSMatrix TSOrientation
Set/get body's orientation.
static readonly TSVector up
A vector with components (0,1,0);
Represents a physical 3D rigid body.
static TSMatrix CreateFromLookAt(TSVector position, TSVector target)
Creates a JMatrix representing an orientation from a quaternion.
InterpolateMode interpolation
Interpolation mode that should be used.
static readonly TSVector zero
A vector with components (0,0,0);
Abstract collider for 3D shapes.
TSVector ScaledCenter
Returns a version of collider's center scaled by parent's transform.
static TSQuaternion CreateFromMatrix(TSMatrix matrix)
Creates a quaternion from a matrix.
static TSVector Transform(TSVector position, TSMatrix matrix)
Transforms a vector by the given matrix.
static readonly TSVector right
A vector with components (1,0,0);
static readonly TSVector forward
A vector with components (0,0,1);
TSCollider tsCollider
Returns the TSCollider attached.
bool IsBodyInitialized
Returns true if the body was already initialized.
IBody3D Body
Returns the body linked to this collider.
A Quaternion representing an orientation.
TSVector TSLinearVelocity
Set/get body's linear velocity.