Files
website/assets/js/40d7c56e.4a8b2815.js
2021-07-22 08:43:46 -05:00

1 line
10 KiB
JavaScript

(self.webpackChunkstardust_website=self.webpackChunkstardust_website||[]).push([[855],{3905:function(e,t,n){"use strict";n.d(t,{Zo:function(){return c},kt:function(){return m}});var a=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,o=function(e,t){if(null==e)return{};var n,a,o={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=o,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||r;return n?a.createElement(f,i(i({ref:t},c),{},{components:n})):a.createElement(f,i({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var p=2;p<r;p++)i[p]=n[p];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"},6580:function(e,t,n){"use strict";n.r(t),n.d(t,{frontMatter:function(){return l},contentTitle:function(){return s},metadata:function(){return p},toc:function(){return c},default:function(){return u}});var a=n(2122),o=n(9756),r=(n(7294),n(3905)),i=["components"],l={sidebar_position:2},s="Spatial",p={unversionedId:"stardust-protocol/server/types/Spatial",id:"stardust-protocol/server/types/Spatial",isDocsHomePage:!1,title:"Spatial",description:"Derived from Node",source:"@site/docs/stardust-protocol/server/types/Spatial.md",sourceDirName:"stardust-protocol/server/types",slug:"/stardust-protocol/server/types/Spatial",permalink:"/docs/stardust-protocol/server/types/Spatial",editUrl:"https://github.com/StardustXR/website/edit/main/docs/stardust-protocol/server/types/Spatial.md",version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"Node",permalink:"/docs/stardust-protocol/server/types/Node"},next:{title:"Model",permalink:"/docs/stardust-protocol/server/types/Model"}},c=[{value:"Derived from Node",id:"derived-from-node",children:[]},{value:"Internal Properties",id:"internal-properties",children:[{value:"<code>translatable: bool</code>",id:"translatable-bool",children:[]},{value:"<code>rotatable: bool</code>",id:"rotatable-bool",children:[]},{value:"<code>scalable: bool</code>",id:"scalable-bool",children:[]}]},{value:"Methods",id:"methods",children:[{value:"<code>move(Vector3 position)</code>",id:"movevector3-position",children:[]},{value:"<code>rotate(Quat rotation)</code>",id:"rotatequat-rotation",children:[]},{value:"<code>rotateAround(Vector3 point, Quat rotation)</code>",id:"rotatearoundvector3-point-quat-rotation",children:[]},{value:"<code>scale(float scale)</code>",id:"scalefloat-scale",children:[]},{value:"<code>setOrigin(Vector3 origin)</code>",id:"setoriginvector3-origin",children:[]},{value:"<code>setOrientation(Quat orientation)</code>",id:"setorientationquat-orientation",children:[]},{value:"<code>setScale(Vector3 scale)</code>",id:"setscalevector3-scale",children:[]},{value:"<code>setPose(Vector3 origin, Quat orientation)</code>",id:"setposevector3-origin-quat-orientation",children:[]},{value:"<code>setTransform(Vector3 origin, Quat orientation)</code>",id:"settransformvector3-origin-quat-orientation",children:[]},{value:"<code>setSpatialParent(string parentPath)</code>",id:"setspatialparentstring-parentpath",children:[]}]}],d={toc:c};function u(e){var t=e.components,n=(0,o.Z)(e,i);return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"spatial"},"Spatial"),(0,r.kt)("h3",{id:"derived-from-node"},"Derived from ",(0,r.kt)("a",{parentName:"h3",href:"Node"},"Node")),(0,r.kt)("p",null,"A base type for types that exist in 3D space, always relative to another space or the engine's world space. Spatials are always relative because in AR or XXR reference spaces change constantly in response to new environments."),(0,r.kt)("h2",{id:"internal-properties"},"Internal Properties"),(0,r.kt)("p",null,"Sometimes it makes sense for a Spatial to not be scalable (like in ",(0,r.kt)("a",{parentName:"p",href:"field/Field"},"Fields"),' where scaling dramatically increases the number of steps to raymarch for pointers) or not be rotatable (point lights) or such, so these are disabled for certain Spatial-derived objects, mentioned right after "Derived from ',(0,r.kt)("a",{parentName:"p",href:"Spatial"},"Spatial"),'".'),(0,r.kt)("h3",{id:"translatable-bool"},(0,r.kt)("inlineCode",{parentName:"h3"},"translatable: bool")),(0,r.kt)("p",null,"If false, object's origin cannot be modified from a client."),(0,r.kt)("h3",{id:"rotatable-bool"},(0,r.kt)("inlineCode",{parentName:"h3"},"rotatable: bool")),(0,r.kt)("p",null,"If false, object's rotation cannot be modified from a client (e.g. point lights, point sound sources)."),(0,r.kt)("h3",{id:"scalable-bool"},(0,r.kt)("inlineCode",{parentName:"h3"},"scalable: bool")),(0,r.kt)("p",null,"If false, object's scale cannot be modified from a client (e.g. ",(0,r.kt)("a",{parentName:"p",href:"field/Field"},"Fields"),", ",(0,r.kt)("a",{parentName:"p",href:"/docs/stardust-protocol/server/types/input/inputtypes/PointerInput"},"PointerInput"),")."),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"movevector3-position"},(0,r.kt)("inlineCode",{parentName:"h3"},"move(Vector3 position)")),(0,r.kt)("p",null,"Moves the Spatial relative to itself if ",(0,r.kt)("inlineCode",{parentName:"p"},"translatable")," is not ",(0,r.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,r.kt)("h3",{id:"rotatequat-rotation"},(0,r.kt)("inlineCode",{parentName:"h3"},"rotate(Quat rotation)")),(0,r.kt)("p",null,"Rotates the Spatial relative to itself if ",(0,r.kt)("inlineCode",{parentName:"p"},"rotatable")," is not ",(0,r.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,r.kt)("h3",{id:"rotatearoundvector3-point-quat-rotation"},(0,r.kt)("inlineCode",{parentName:"h3"},"rotateAround(Vector3 point, Quat rotation)")),(0,r.kt)("p",null,"Rotates the Spatial around ",(0,r.kt)("inlineCode",{parentName:"p"},"point")," (relative to itself) if ",(0,r.kt)("inlineCode",{parentName:"p"},"rotatable")," is not ",(0,r.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,r.kt)("h3",{id:"scalefloat-scale"},(0,r.kt)("inlineCode",{parentName:"h3"},"scale(float scale)")),(0,r.kt)("p",null,"Multiplies the Spatial's scale vector by ",(0,r.kt)("inlineCode",{parentName:"p"},"scale")," if ",(0,r.kt)("inlineCode",{parentName:"p"},"scalable")," is not ",(0,r.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,r.kt)("h3",{id:"setoriginvector3-origin"},(0,r.kt)("inlineCode",{parentName:"h3"},"setOrigin(Vector3 origin)")),(0,r.kt)("p",null,"Sets the origin to ",(0,r.kt)("inlineCode",{parentName:"p"},"origin")," if ",(0,r.kt)("inlineCode",{parentName:"p"},"translatable")," is not ",(0,r.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,r.kt)("h3",{id:"setorientationquat-orientation"},(0,r.kt)("inlineCode",{parentName:"h3"},"setOrientation(Quat orientation)")),(0,r.kt)("p",null,"Sets the orientation to ",(0,r.kt)("inlineCode",{parentName:"p"},"orientation")," if ",(0,r.kt)("inlineCode",{parentName:"p"},"rotatable")," is not ",(0,r.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,r.kt)("h3",{id:"setscalevector3-scale"},(0,r.kt)("inlineCode",{parentName:"h3"},"setScale(Vector3 scale)")),(0,r.kt)("p",null,"Sets the scale to ",(0,r.kt)("inlineCode",{parentName:"p"},"scale")," if ",(0,r.kt)("inlineCode",{parentName:"p"},"scalable")," is not ",(0,r.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,r.kt)("h3",{id:"setposevector3-origin-quat-orientation"},(0,r.kt)("inlineCode",{parentName:"h3"},"setPose(Vector3 origin, Quat orientation)")),(0,r.kt)("p",null,"Sets the pose relative to the Spatial's space if ",(0,r.kt)("inlineCode",{parentName:"p"},"translatable")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"rotatable")," are true. This method saves on IPC calls compared to ",(0,r.kt)("inlineCode",{parentName:"p"},"setOrigin")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"setOrientation")," in sequence."),(0,r.kt)("h3",{id:"settransformvector3-origin-quat-orientation"},(0,r.kt)("inlineCode",{parentName:"h3"},"setTransform(Vector3 origin, Quat orientation)")),(0,r.kt)("p",null,"Sets the transform relative to the Spatial's space if ",(0,r.kt)("inlineCode",{parentName:"p"},"translatable"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"rotatable")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"scalable")," are true. This method saves on IPC calls compared to ",(0,r.kt)("inlineCode",{parentName:"p"},"setOrigin"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"setOrientation"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"setScale")," in sequence."),(0,r.kt)("h3",{id:"setspatialparentstring-parentpath"},(0,r.kt)("inlineCode",{parentName:"h3"},"setSpatialParent(string parentPath)")),(0,r.kt)("p",null,"Sets the spatial parent of this ",(0,r.kt)("inlineCode",{parentName:"p"},"Spatial"),' while keeping the "absolute" position in space intact.'))}u.isMDXComponent=!0}}]);