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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Scene Origin — NVIDIA PhysX SDK 3.4.2 Documentation</title>
<link rel="stylesheet" href="../_static/nvidia.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/breathe.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '3.4.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</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>
<link rel="top" title="NVIDIA PhysX SDK 3.4.2 Documentation" href="../index.html" />
<link rel="up" title="User's Guide" href="Index.html" />
<link rel="next" title="GPU Rigid Bodies" href="GPURigidBodies.html" />
<link rel="prev" title="Articulations" href="Articulations.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="GPURigidBodies.html" title="GPU Rigid Bodies"
accesskey="N">next</a></li>
<li class="right" >
<a href="Articulations.html" title="Articulations"
accesskey="P">previous</a> |</li>
<li><a href="../Index.html">NVIDIA PhysX SDK 3.4.2 Documentation</a> »</li>
<li><a href="Index.html" accesskey="U">User's Guide</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="scene-origin">
<span id="originshift"></span><h1>Scene Origin<a class="headerlink" href="#scene-origin" title="Permalink to this headline">¶</a></h1>
<p>The further away objects move from the origin, the larger the chance to suffer from floating point precision issues. This can cause troubles especially in scenarios with big game worlds. To avoid these problems, a straightforward solution seems to teleport all objects towards the origin in certain intervals. However, this is not only cumbersome but can also be pretty expensive due to the invalidation of cached data and persistent state. To address some of these issues, PhysX offers an API to shift the origin of a scene.</p>
<div class="section" id="shifting-the-scene-origin">
<h2>Shifting The Scene Origin<a class="headerlink" href="#shifting-the-scene-origin" title="Permalink to this headline">¶</a></h2>
<p>The following method will shift the origin of a scene by a translation vector:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">PxScene</span><span class="o">::</span><span class="n">shiftOrigin</span><span class="p">(</span><span class="k">const</span> <span class="n">PxVec3</span><span class="o">&</span> <span class="n">shift</span><span class="p">)</span>
</pre></div>
</div>
<p>The positions of all objects in the scene and the corresponding data structures will get adjusted to reflect the new origin location (basically, the shift vector will get subtracted from all object positions). The intended use pattern for this API is to shift the origin such that object positions move closer towards zero. Please note that it is the user's responsibility to keep track of the summed total origin shift and adjust all input/output to/from PhysX accordingly.
Even though this method preserves some of the internally cached data, it is still an expensive operation and we recommend to use it only in the case where distance related precision issues may arise in areas far from the origin.
If extension modules of PhysX are used like the character controller or vehicle library, then it will be necessary to propagate the scene shift to those modules as well. Please refer to the API documentation of these modules for details.</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../Index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Scene Origin</a><ul>
<li><a class="reference internal" href="#shifting-the-scene-origin">Shifting The Scene Origin</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="Articulations.html"
title="previous chapter">Articulations</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="GPURigidBodies.html"
title="next chapter">GPU Rigid Bodies</a></p>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="GPURigidBodies.html" title="GPU Rigid Bodies"
>next</a></li>
<li class="right" >
<a href="Articulations.html" title="Articulations"
>previous</a> |</li>
<li><a href="../Index.html">NVIDIA PhysX SDK 3.4.2 Documentation</a> »</li>
<li><a href="Index.html" >User's Guide</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2008-2018 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved.
</div>
</body>
</html>
|