Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. // Using Verlet Integration to solve constrains and velocity
  5. // This iteration is working much better then my first try
  6. // at making a rope with physics. I've tried to do the same
  7. // but with a different approach and it didn't work out.
  8. // This code is all from UE4 CableComponent.
  9. // Converted it in C# to test within Unity, due slow pc at home.
  10. public class FParticle : MonoBehaviour {
  11. #region public Properties
  12. public Vector3 OldPosition;
  13. public bool bFree;
  14. #endregion
  15.  
  16. #region private Properties
  17. private Transform _transform;
  18. #endregion
  19.  
  20. #region Unity Methods
  21. void Awake() {
  22. _transform = transform;
  23. }
  24.  
  25. void Start() {
  26. OldPosition = _transform.position;
  27. position = _transform.position;
  28. }
  29. #endregion
  30.  
  31. #region public Getters & Setters
  32. public Vector3 position {
  33. get { return _transform.position; }
  34. set { _transform.position = value; }
  35. }
  36. #endregion
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement