1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created by texi2html 1.64 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
-->
<HTML>
<HEAD>
<TITLE>Crystal Space: csPhyziks Forces</TITLE>
<META NAME="description" CONTENT="Crystal Space: csPhyziks Forces">
<META NAME="keywords" CONTENT="Crystal Space: csPhyziks Forces">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="texi2html 1.64">
</HEAD>
<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<A NAME="SEC329"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_151.html#SEC328"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_153.html#SEC330"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_143.html#SEC311"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_149.html#SEC326"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_159.html#SEC338"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_285.html#SEC711">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<HR SIZE=1>
<H3> 6.7.3 Forces </H3>
<!--docid::SEC329::-->
<P>
There are many types of forces that can be used. More are easy to add as
well. The three main types are environmental forces, N-body forces, and
simple forces.
</P><P>
Environmental forces are added to a `<SAMP>ctWorld</SAMP>' and act on all bodies in
that world, for example gravity, air resistance, etc.
</P><P>
<TABLE><tr><td> </td><td class=example><pre>ctGravityF* gf = new ctGravityF(9.81 / M_PER_WORLDUNIT);
phyz_world.add_enviro_force(gf);
</pre></td></tr></table></P><P>
N-body forces are forces that act between multiple bodies, for example springs
and planetary gravity.
</P><P>
<TABLE><tr><td> </td><td class=example><pre>ctVector3 spring_attachment_point1(0, 1, 0);
ctSpringF* sf = new ctSpringF(
rb1, spring_attachment_point1,
rb2, spring_attachment_point2);
sf->set_magnitude(200.0 / M_PER_WORLDUNIT);
// Need to add force to each body it affects.
rb1->add_force(sf);
rb2->add_force(sf);
</pre></td></tr></table></P><P>
Specify the second body as `<SAMP>NULL</SAMP>' to indicate that end is attached to
the world and is therefore immovable.
</P><P>
Simple forces would be something like a rocket engine or other kind of force
that only acts on one body.
</P><P>
<A NAME="csPhyziks Articulated Bodies"></A>
<HR SIZE=1>
<BR>
<FONT SIZE="-1">
This document was generated
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>
</BODY>
</HTML>
|