1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
"use strict";(self.webpackChunkstardust_website=self.webpackChunkstardust_website||[]).push([[855],{3905:function(e,t,n){n.d(t,{Zo:function(){return c},kt:function(){return h}});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),h=o,m=u["".concat(s,".").concat(h)]||u[h]||d[h]||r;return n?a.createElement(m,i(i({ref:t},c),{},{components:n})):a.createElement(m,i({ref:t},c))}));function h(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){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(7462),o=n(3366),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:"<code>zoneable: bool</code>",id:"zoneable-bool",children:[]}]},{value:"Signals",id:"signals",children:[{value:"<code>move(Vector3 position)</code>",id:"movevector3-position",children:[]},{value:"<code>rotate(Quat rotation)</code>",id:"rotatequat-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:[]},{value:"<code>setSpatialParentInPlace(string parentPath)</code>",id:"setspatialparentinplacestring-parentpath",children:[]},{value:"<code>setZoneable(bool zoneable)</code>",id:"setzoneablebool-zoneable",children:[]}]},{value:"Methods",id:"methods",children:[{value:"<code>Vector<Vector3 origin, Quat orientation, Vector3 scale> getTransform(null)</code>",id:"vectorvector3-origin-quat-orientation-vector3-scale-gettransformnull",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)("h3",{id:"zoneable-bool"},(0,r.kt)("inlineCode",{parentName:"h3"},"zoneable: bool")),(0,r.kt)("p",null,"If false, no zones will see that this spatial exists. Useful for locking objects in space so they aren't affected by workspaces and generally shouldn't be true for anything other than the root spatial of an object."),(0,r.kt)("h2",{id:"signals"},"Signals"),(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:"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 object in the same place in local space."),(0,r.kt)("h3",{id:"setspatialparentinplacestring-parentpath"},(0,r.kt)("inlineCode",{parentName:"h3"},"setSpatialParentInPlace(string parentPath)")),(0,r.kt)("p",null,"Sets the spatial parent of this ",(0,r.kt)("inlineCode",{parentName:"p"},"Spatial")," while not changing the object's absolute position."),(0,r.kt)("h3",{id:"setzoneablebool-zoneable"},(0,r.kt)("inlineCode",{parentName:"h3"},"setZoneable(bool zoneable)")),(0,r.kt)("p",null,"Enable/disable this spatial's zoneable property."),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"vectorvector3-origin-quat-orientation-vector3-scale-gettransformnull"},(0,r.kt)("inlineCode",{parentName:"h3"},"Vector<Vector3 origin, Quat orientation, Vector3 scale> getTransform(null)")),(0,r.kt)("p",null,"Returns the ",(0,r.kt)("inlineCode",{parentName:"p"},"origin"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"orientation"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"scale")," of this spatial relative to its parent."))}u.isMDXComponent=!0}}]); |