Package org.vrspace.server.api
Class WorldObjects
java.lang.Object
org.vrspace.server.api.ApiBase
org.vrspace.server.api.ClientControllerBase
org.vrspace.server.api.WorldObjects
@RestController
@RequestMapping("/vrspace/api/world")
public class WorldObjects
extends ClientControllerBase
Interact with the current world: add, remove, and change basic properties of
VRObject instances. Instances of VRObject subclasses (e.g. User, Terrain)
cannot be accessed this way. To be removed or changed, the object must be
owned, and present in the scene (i.e. visible).
- Author:
- joe
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd a shared object to the world, equivalent of websocket Add command.void
objectCoordinates
(jakarta.servlet.http.HttpSession session, VRObject changes) Change position, rotation and/or scale of an object.void
removeObject
(jakarta.servlet.http.HttpSession session, String id) Remove a shared VRObject.Methods inherited from class org.vrspace.server.api.ClientControllerBase
findClient, findClient, getAuthorisedClient, getAuthorisedClient, isAuthenticated
Methods inherited from class org.vrspace.server.api.ApiBase
currentUserName, isAuthenticated
-
Field Details
-
PATH
- See Also:
-
-
Constructor Details
-
WorldObjects
public WorldObjects()
-
-
Method Details
-
addObject
@PutMapping("/add") public VRObject addObject(jakarta.servlet.http.HttpSession session, @RequestBody VRObject obj) Add a shared object to the world, equivalent of websocket Add command. Once created, the object is immediately published, i.e. pushed to all clients, including the creator, through websockets. Unlike Add command, that can be used to create world objects of any class, e.g. Terrain, this can only create VRObject class instances.- Parameters:
obj
- VRObject to create, must not have an id- Returns:
- the created VRObject, including the id
-
removeObject
@DeleteMapping("/remove") public void removeObject(jakarta.servlet.http.HttpSession session, String id) Remove a shared VRObject.- Parameters:
id
- object id
-
objectCoordinates
@PatchMapping("/coordinates") public void objectCoordinates(jakarta.servlet.http.HttpSession session, @RequestBody VRObject changes) Change position, rotation and/or scale of an object. All other object properties are ignored.
-