Files
PhysX4.1/physx/documentation/PhysXGuide/Manual/HelloWorld.html
2025-11-28 23:13:44 +05:30

296 lines
12 KiB
HTML

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Snippets &mdash; NVIDIA PhysX SDK 4.1 Documentation</title>
<link rel="shortcut icon" href="_static/images/favicon.ico"/>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/breathe.css" type="text/css" />
<link rel="next" title="Building with PhysX" href="BuildingWithPhysX.html" />
<link rel="prev" title="Welcome to PhysX" href="Introduction.html" />
<link href="../_static/css/nvidia_theme.css" rel="stylesheet" type="text/css">
<style>
.wy-nav-content::before {
content: "PhysX 4.1 SDK Guide";
}
</style>
<script src="../_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="../Index.html" class="icon icon-home"> Python
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="Index.html">User's Guide</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="License.html">PhysX License</a></li>
<li class="toctree-l2"><a class="reference internal" href="Introduction.html">Welcome to PhysX</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="">Snippets</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#what-are-physx-snippets">What are PhysX Snippets?</a></li>
<li class="toctree-l3"><a class="reference internal" href="#helloworld-physx-basics">HelloWorld: PhysX Basics</a></li>
<li class="toctree-l3"><a class="reference internal" href="#using-physx-visual-debugger-with-snippethelloworld">Using PhysX Visual Debugger with SnippetHelloWorld</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="BuildingWithPhysX.html">Building with PhysX</a></li>
<li class="toctree-l2"><a class="reference internal" href="API.html">The PhysX API</a></li>
<li class="toctree-l2"><a class="reference internal" href="Startup.html">Startup and Shutdown</a></li>
<li class="toctree-l2"><a class="reference internal" href="Threading.html">Threading</a></li>
<li class="toctree-l2"><a class="reference internal" href="Geometry.html">Geometry</a></li>
<li class="toctree-l2"><a class="reference internal" href="RigidBodyOverview.html">Rigid Body Overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="RigidBodyCollision.html">Rigid Body Collision</a></li>
<li class="toctree-l2"><a class="reference internal" href="RigidBodyDynamics.html">Rigid Body Dynamics</a></li>
<li class="toctree-l2"><a class="reference internal" href="Simulation.html">Simulation</a></li>
<li class="toctree-l2"><a class="reference internal" href="AdvancedCollisionDetection.html">Advanced Collision Detection</a></li>
<li class="toctree-l2"><a class="reference internal" href="Joints.html">Joints</a></li>
<li class="toctree-l2"><a class="reference internal" href="Articulations.html">Articulations</a></li>
<li class="toctree-l2"><a class="reference internal" href="Articulations.html#maximal-coordinate-and-reduced-articulations">Maximal Coordinate and Reduced Articulations</a></li>
<li class="toctree-l2"><a class="reference internal" href="Articulations.html#maximal-coordinate-articulations">Maximal Coordinate Articulations</a></li>
<li class="toctree-l2"><a class="reference internal" href="Articulations.html#reduced-coordinate-articulations">Reduced Coordinate Articulations</a></li>
<li class="toctree-l2"><a class="reference internal" href="OriginShift.html">Scene Origin</a></li>
<li class="toctree-l2"><a class="reference internal" href="GPURigidBodies.html">GPU Rigid Bodies</a></li>
<li class="toctree-l2"><a class="reference internal" href="GeometryQueries.html">Geometry Queries</a></li>
<li class="toctree-l2"><a class="reference internal" href="SceneQueries.html">Scene Queries</a></li>
<li class="toctree-l2"><a class="reference internal" href="Vehicles.html">Vehicles</a></li>
<li class="toctree-l2"><a class="reference internal" href="CharacterControllers.html">Character Controllers</a></li>
<li class="toctree-l2"><a class="reference internal" href="DebugVisualization.html">Debug Visualization</a></li>
<li class="toctree-l2"><a class="reference internal" href="VisualDebugger.html">PhysX Visual Debugger (PVD)</a></li>
<li class="toctree-l2"><a class="reference internal" href="Statistics.html">Simulation Statistics</a></li>
<li class="toctree-l2"><a class="reference internal" href="Serialization.html">Serialization</a></li>
<li class="toctree-l2"><a class="reference internal" href="ExtendingSerialization.html">Extending Serialization</a></li>
<li class="toctree-l2"><a class="reference internal" href="BestPractices.html">Best Practices Guide</a></li>
<li class="toctree-l2"><a class="reference internal" href="MigrationFrom28.html">Migrating From PhysX SDK 2.x to 3.x</a></li>
<li class="toctree-l2"><a class="reference internal" href="MigrationTo33.html">Migrating From PhysX SDK 3.2 to 3.3</a></li>
<li class="toctree-l2"><a class="reference internal" href="MigrationTo34.html">Migrating From PhysX SDK 3.3 to 3.4</a></li>
<li class="toctree-l2"><a class="reference internal" href="MigrationTo40.html">Migrating From PhysX SDK 3.4 to 4.0</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../Index.html">Python</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../Index.html">Docs</a> &raquo;</li>
<li><a href="Index.html">User's Guide</a> &raquo;</li>
<li>Snippets</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="snippets">
<span id="helloworld"></span><h1>Snippets<a class="headerlink" href="#snippets" title="Permalink to this headline"></a></h1>
<div class="section" id="what-are-physx-snippets">
<h2>What are PhysX Snippets?<a class="headerlink" href="#what-are-physx-snippets" title="Permalink to this headline"></a></h2>
<p>In the context of the PhysX SDK, a 'Snippet' is a simple, minimalistic code sample.
PhysX-SDK version 3.3.0 offers a collection of Snippets to illustrate usage of the PhysX API in a
concise format, free from the complexity of a sample framework or game engine. The Snippets folder is
in the top-level directory of the PhysX SDK, alongside directories for Documentation, Include, Samples, etc.</p>
<dl class="docutils">
<dt>The folder {SDK Root}/Snippets/compiler/{platform} contains the Snippets solution file, e.g.</dt>
<dd>Snippets/compiler/vc14win64/Snippets.sln</dd>
</dl>
<p>Although a few of the Snippets support rendering, ( Win32, Win64, OSX and Linux only ) most Snippets do not provide rendering, require no input,
and provide only limited output through messages. Although Snippets can be run from a command prompt or by double-clicking the executable
icon, the best way to explore Snippets is by viewing the code in the Visual Studio IDE, and running the program in the debugger.</p>
</div>
<div class="section" id="helloworld-physx-basics">
<span id="helloworldbasics"></span><h2>HelloWorld: PhysX Basics<a class="headerlink" href="#helloworld-physx-basics" title="Permalink to this headline"></a></h2>
<p>SnippetHelloWorld illustrates basic use of PhysX, from startup to shutdown of a simple scene, and
is a good place to start learning the PhysX API. The simplest Snippets comprise a single source file, but SnippetHelloWorld,
among others, supports optional rendering through a second source file. SnippetHelloWorld creates a number of box stacks on
a plane, and if rendering is enabled, allows the user to create new stacks and fire a ball from the camera position.</p>
<p>The primary code for SnippetHelloWorld is found in {SDK Root}/Snippets/SnippetHelloWorld/SnippetHelloWorld.cpp.</p>
</div>
<div class="section" id="using-physx-visual-debugger-with-snippethelloworld">
<span id="pvdandhelloworld"></span><h2>Using PhysX Visual Debugger with SnippetHelloWorld<a class="headerlink" href="#using-physx-visual-debugger-with-snippethelloworld" title="Permalink to this headline"></a></h2>
<p>As is the case with any Snippet built against PROFILE, CHECKED or DEBUG configurations of the PhysX runtime,
HelloWorld will automatically connect to the PhysX Visual Debugger if that application is already running
when the Snippet executable is launched. For Snippets without rendering, PVD provides an easy way to visualize
the contents of the PhysX scene presented in the Snippet. In the screenshot image below, PhysX Visual Debugger appears on
the right hand side, while Visual Studio and Snippet Hello World are on the left.</p>
<img alt="../_images/HelloWorld.png" src="../_images/HelloWorld.png" />
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="BuildingWithPhysX.html" class="btn btn-neutral float-right" title="Building with PhysX" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="Introduction.html" class="btn btn-neutral" title="Welcome to PhysX" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2008-2021 NVIDIA Corporation, 2788 San Tomas Expressway, Santa Clara, CA 95051 U.S.A. All rights reserved
</p>
</div>
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../',
VERSION:'4.1',
LANGUAGE:'',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: ''
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(false);
});
</script>
</body>
</html>