16 [
Attribute(
"0",
UIWidgets.ComboBox,
"Which axis to use for the hinge",
"", { ParamEnum(
"Yaw",
"1"), ParamEnum(
"Pitch",
"0"), ParamEnum(
"Roll",
"2")} )]
20 [
Attribute(
"0",
UIWidgets.Slider,
"Minimum rotate range in degrees (if minimum is higher than maximum, hinge can rotate freely)",
"-180 0 0.01")]
22 [
Attribute(
"0",
UIWidgets.Slider,
"Maximum rotate range in degrees (if minimum is higher than maximum, hinge can rotate freely)",
"0 180 0.01")]
24 [
Attribute(
"0.5",
UIWidgets.Slider,
"Percentage of limits where movement is free, above this the limit is gradually enforced",
"0 1 0.001")]
26 [
Attribute(
"0.3",
UIWidgets.Slider,
"The strength with which the constraint resists limit violations",
"0 1 0.001")]
28 [
Attribute(
"1",
UIWidgets.Slider,
"The lower the values, the less the constraint will fight velocities which violate the angular limits",
"0 1 0.001")]
29 float m_RelaxationFactor;
51 override void DebugDisplay()
57 int axis2 = m_Axis + 1;
60 int axis3 = axis2 + 1;
63 vector axisVec = mat[m_Axis];
64 vector axisVec2 = mat[axis2];
65 vector axisVec3 = mat[axis3];
72 if (m_RotateMax > m_RotateMin)
73 sliceSubDiv =
Math.Ceil(
Math.AbsFloat(-m_RotateMax - -m_RotateMin) / 360 * 16);
79 CreateCircleSlice(pos, axisVec, axisVec2, m_RotateMin + addVisAng, m_RotateMax + addVisAng, 0.075,
ARGB(255, 0, 255, 255), sliceSubDiv,
ShapeFlags.ONCE|
ShapeFlags.NOZBUFFER);
86 override void RotateJoint(inout
vector jointMat[4])
91 vector oldJointMat[3], rotMat[3];
92 oldJointMat[0] = jointMat[0];
93 oldJointMat[1] = jointMat[1];
94 oldJointMat[2] = jointMat[2];
96 Math3D.AnglesToMatrix(
"90 0 0", rotMat);
98 Math3D.AnglesToMatrix(
"0 90 0", rotMat);
99 Math3D.MatrixMultiply3(oldJointMat, rotMat, jointMat);
106 m_Joint =
PhysicsJoint.CreateHinge2(parent, child, jointMat1, jointMat2, m_CollisionBlocker, -1);
109 jointHinge.SetLimits(1, -1, m_Softness, m_BiasFactor, m_RelaxationFactor);
111 jointHinge.SetLimits(-m_RotateMax *
Math.DEG2RAD, -m_RotateMin *
Math.DEG2RAD, m_Softness, m_BiasFactor, m_RelaxationFactor);
Shape CreateCircleSlice(vector pos, vector aroundDir, vector forwardDir, float angMin, float angMax, float radius, int color, int subdivisions, ShapeFlags flags)
Shape CreateCircle(vector pos, vector aroundDir, float radius, int color, int subdivisions, ShapeFlags flags)
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.