Files
RCBASIC4/doc/doc_files/createslideconstraintex.html
2024-10-24 23:25:02 -04:00

108 lines
4.6 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<style>
table, th, td { border: 1px solid black; } th, td { padding: 10px; }
body { background-color: #064066; color: #FFFFFF; }
a { color: #40bfb8; }
a::before {
content: "---";
font-family: monospace, monospace;
display: inline-block;
margin-right: 6px;
color: #064066;
}
.rc_number { color: #0b9898; }
.rc_string { color: #dd4040; }
.rc_keyword { color: #6084a8; font-weight: bold; }
.rc_comment { color: #6e716e; }
#rc_code { font-family: Consolas,"courier new"; background-color: #2d3335; padding: 2px; font-size: 105%; }
ul, #myUL {
list-style-type: none;
}
#myUL {
margin: 0;
padding: 0;
}
.box {
cursor: pointer;
-webkit-user-select: none; /* Safari 3.1+ */
-moz-user-select: none; /* Firefox 2+ */
-ms-user-select: none; /* IE 10+ */
user-select: none;
}
.box::before {
content: "[+]";
font-family: monospace, monospace;
font-weight: bold;
color: #40bfb8;
display: inline-block;
margin-right: 6px;
}
.box {
font-weight: bold;
color: #40bfb8;
text-decoration: underline;
}
.check-box::before {
content: "[-]";
font-family: monospace, monospace;
font-weight: bold;
//color: dodgerblue;
color: #40bfb8;
}
.nested {
display: none;
}
.active {
display: block;
}
</style>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title>createSlideConstraintEx [RCBasic Doc] </title>
</head>
<body>
<p><h1>function createSlideConstraintEx( actorA, actorB, frameInA_matrix, frameInB_matrix, useLinearReferenceFrameA) </h1></p>
<p>
A type of constraint that restricts the motion between two actors (or between an actor and the world) in such a way that they can slide along a specific axis and rotate around the same axis, while limiting or allowing movement along other axes. This constraint is similar to a prismatic joint with added rotational freedom, making it useful for simulating objects like pistons, sliding doors, or rail systems.
</p>
<p id="rc_code"><code>
actorA&nbsp;=&nbsp;CreateCubeActor<b>(</b><span class="rc_number">100</span><b>)</b>&nbsp;<span class="rc_comment">'Creates a cube actor </span><br>
frameA&nbsp;=&nbsp;DimMatrix<b>(</b><span class="rc_number">4</span>,&nbsp;<span class="rc_number">4</span><b>)</b>&nbsp;<span class="rc_comment">'A transform matrix must be a 4x4 matrix </span><br>
SetIdentityMatrix<b>(</b>frameA,&nbsp;<span class="rc_number">4</span><b>)</b>&nbsp;<span class="rc_comment">'Sets frameB to a 4x4 identity matrix </span><br>
SetMatrixTranslation<b>(</b>frameA,&nbsp;<span class="rc_number">0</span>,&nbsp;<span class="rc_number">0</span>,&nbsp;<span class="rc_number">0</span><b>)</b>&nbsp;<span class="rc_comment">'Sets the attach point of the constraint to center of the cube </span><br>
SetMatrixRotation<b>(</b>frameA,&nbsp;<span class="rc_number">0</span>,&nbsp;<span class="rc_number">90</span>,&nbsp;<span class="rc_number">0</span><b>)</b>&nbsp;<span class="rc_comment">'Rotates the constraint axis by 90 degrees around y </span><br>
&nbsp;&nbsp;<br>
actorB&nbsp;=&nbsp;CreateCubeActor<b>(</b><span class="rc_number">100</span><b>)</b>&nbsp;<span class="rc_comment">'Creates a cube actor </span><br>
frameB&nbsp;=&nbsp;DimMatrix<b>(</b><span class="rc_number">4</span>,&nbsp;<span class="rc_number">4</span><b>)</b>&nbsp;<span class="rc_comment">'A transform matrix must be a 4x4 matrix </span><br>
SetIdentityMatrix<b>(</b>frameB,&nbsp;<span class="rc_number">4</span><b>)</b>&nbsp;<span class="rc_comment">'Sets frameB to a 4x4 identity matrix </span><br>
SetMatrixTranslation<b>(</b>frameB,&nbsp;<span class="rc_number">0</span>,&nbsp;<span class="rc_number">50</span>,&nbsp;<span class="rc_number">0</span><b>)</b>&nbsp;<span class="rc_comment">'Sets the attach point of the constraint to the top of the cube </span><br>
SetMatrixRotation<b>(</b>frameB,&nbsp;<span class="rc_number">0</span>,&nbsp;<span class="rc_number">90</span>,&nbsp;<span class="rc_number">0</span><b>)</b>&nbsp;<span class="rc_comment">'Rotates the constraint axis by 90 degrees around y </span><br>
slide&nbsp;=&nbsp;CreateSlideConstraintEx<b>(</b>actorA,&nbsp;actorB,&nbsp;frameA,&nbsp;frameB,&nbsp;<span class="rc_keyword">true</span><b>)</b>&nbsp;<br>
</code></p>
<p>
Note: It is recommended to use CreateSlideConstraintEx() in most cases
</p>
<br><p>Related:
<a href="createslideconstraint.html">CreateSlideConstraint</a>
<a href="setidentitymatrix.html">SetIdentityMatrix</a>
<a href="setmatrixtranslation.html">SetMatrixTranslation</a>
<a href="setmatrixrotation.html">SetMatrixRotation</a>
</p>
<p>
</body>
</html>