| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
- //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
- namespace BansheeEngine
- {
- /// <summary>
- /// Joint that removes all but a single translational degree of freedom. Bodies are allowed to move along a single axis.
- /// </summary>
- public sealed class SliderJoint : Joint
- {
- [SerializeField]
- private LimitLinearRange limit = new LimitLinearRange();
- [SerializeField]
- private bool enableLimit;
- /// <summary>
- /// Determines the limit that constrains the movement of the joint to a specific minimum and maximum distance. You
- /// must enable <see cref="EnableLimit"/> for this to be enforced.
- /// </summary>
- public LimitLinearRange Limit
- {
- get { return limit; }
- set
- {
- if (limit == value)
- return;
- limit = value;
- if (Native != null)
- Native.Limit = value;
- }
- }
- /// <summary>
- /// Enables or disables the limit that clamps the movement of the joint.
- /// </summary>
- public bool EnableLimit
- {
- get { return enableLimit; }
- set
- {
- if (enableLimit == value)
- return;
- enableLimit = value;
- if (Native != null)
- Native.EnableLimit = value;
- }
- }
- /// <summary>
- /// Returns the native joint wrapped by this component.
- /// </summary>
- private NativeSliderJoint Native
- {
- get { return (NativeSliderJoint)native; }
- }
- /// <inheritdoc/>
- internal override NativeJoint CreateNative()
- {
- NativeSliderJoint joint = new NativeSliderJoint();
- // TODO - Apply this all at once to avoid all the individual interop function calls
- joint.Limit = limit;
- joint.EnableLimit = enableLimit;
- return joint;
- }
- }
- }
|