object interface - Outerra/anteworld GitHub Wiki
In script_module api
this.object = this.get_object(object_id);
Can be also retreived from creating instance script_module api (object of created instance is returned)
this.object = this.create_instance(instance_path, start_pos, start_rot, object_type);
// or
this.object = this.create_static_instance(instance_path, start_pos, start_rot, object_type);
In script_module api
self.object = self:get_object(object_id);
Can be also retreived from creating instance script_module api (object of created instance is returned)
self.object = self:create_instance(instance_path, start_pos, start_rot, object_type);
// or
self.object = self:create_static_instance(instance_path, start_pos, start_rot, object_type);
virtual ot::objcat category() const = 0; |
||
Parameter Description | Returns | Description |
---|---|---|
- | returns: category of the underlying object | Return category of the underlying object |
virtual ot::objtype type_mask() const = 0; |
||
Parameter Description | Returns | Description |
- | returns: type mask of the underlying object | Return type mask of the underlying object |
virtual uint id() const = 0; |
||
Parameter Description | Returns | Description |
- | returns: unique object ID | Return unique object ID |
virtual void* get_custom_data() const = 0; |
||
Parameter Description | Returns | Description |
- | returns: custom data | Get custom data |
virtual void set_custom_data(void* p) = 0; |
||
Parameter Description | Returns | Description |
p: pointer to custom data | - | Set custom data |
virtual uint get_editor_id() const = 0; |
||
Parameter Description | Returns | Description |
- | returns: editor ID | Get editor ID |
virtual void set_editor_id(uint id) = 0; |
||
Parameter Description | Returns | Description |
id: editor ID | - | Set editor ID |
virtual coid::token get_objurl() const = 0; |
||
Parameter Description | Returns | Description |
- | returns: object path (package URL) | Return object path (package URL) |
virtual bool get_objdef_info(ifc_out ot::pkginfo::obj& info) const = 0; |
||
Parameter Description | Returns | Description |
info: object definition information | returns: true if the objdef information was successfully retrieved | Retrieve objdef information |
virtual coid::token get_objdef_param(const coid::token& key, const coid::token& group = coid::token()) const = 0; |
||
Parameter Description | Returns | Description |
---|---|---|
key: parameter key group: parameter group |
returns: parameter from objdef | Return parameter from objdef |
virtual const double3& get_pos() const = 0; |
||
Parameter Description | Returns | Description |
---|---|---|
- | returns: ECEF world position | Return ECEF world position |
virtual void set_pos(const double3& pos) = 0; |
||
Parameter Description | Returns | Description |
pos: world position | - | Set world position |
virtual const quat& get_rot() const = 0; |
||
Parameter Description | Returns | Description |
- | returns: object rotation from the reference frame (-z forward, +y up) | Return object rotation from the reference frame (-z forward, +y up) |
virtual void set_rot(const quat& rot) = 0; |
||
Parameter Description | Returns | Description |
rot: object rotation | - | Set object rotation from the reference frame (-z forward, +y up) |
virtual void set_pos_rot(const double3& pos, const quat& rot) = 0; |
||
Parameter Description | Returns | Description |
pos: world position rot: object rotation |
- | Set position and rotation |
virtual int get_positional_data(ifc_out ot::dynamic_pos& data) const = 0; |
||
Parameter Description | Returns | Description |
data: positional data | returns: true if data was successfully retrieved | Retrieve positional data |
virtual bool set_positional_data(const ot::dynamic_pos& data) = 0; |
||
Parameter Description | Returns | Description |
data: positional data | returns: true if data was successfully set | Set positional data |
virtual void set_fps_camera_pos(const float3& pos, uint joint_id = UMAX32, ot::EJointRotationMode joint_rotation = ot::JointRotModeEnable) = 0; |
||
Parameter Description | Returns | Description |
---|---|---|
pos: FPS camera position joint_id: joint id joint_rotation: joint rotation mode |
- | Set model space position for FPS camera |
virtual void set_fps_camera_rot(const quat& rot, ot::ERotationMode mouse_rotation) = 0; |
||
Parameter Description | Returns | Description |
---|---|---|
rot: model space rotation mouse_rotation: mouse rotation mode: 0 freeze, 1 reset&disable, 2 enable, 3 reset & enable |
- | Set model space rotation frame |
virtual void set_fps_camera_fov(float hfov, float vfov = 0) = 0; |
||
Parameter Description | Returns | Description |
hfov: horizontal FOV in degrees, 0 to reset to the default one vfov: optional vertical FOV in degrees, otherwise computed from aspect ratio |
- | Set FOV to chassis fps preset and also to current camera if vehicle is entered and fpc camera is active |
virtual float3 get_fps_camera_pos() const = 0; |
||
Parameter Description | Returns | Description |
- | returns: current FPS camera position | Return current FPS camera position |
virtual quat get_fps_camera_rot(bool base = false) const = 0; |
||
Parameter Description | Returns | Description |
base: true for the base orientation frame, false for current camera orientation as | returns: current FPS camera rotation in model space | Return current FPS camera rotation in model space |
virtual float2 get_fps_camera_fov() const = 0; |
||
Parameter Description | Returns | Description |
- | returns: FPS camera preset FOV for this chassis | Get FPS camera preset FOV for this chassis |
virtual float3 heading_pitch_roll() const = 0; |
||
Parameter Description | Returns | Description |
- | returns: heading/pitch/roll angles of the object in radians | Get heading/pitch/roll angles of the object in radians |
virtual iref<ot::geomob> get_geomob(int id = 0) const = 0; |
||
Parameter Description | Returns | Description |
id: 0 the main body | returns: geomob reference | Get geomob reference by id |
virtual ot::ECameraMode enter(ot::ECameraMode camode = ot::CamPrevious, ot::EControlsBinding bindio = ot::BindControls) = 0; |
||
Parameter Description | Returns | Description |
---|---|---|
camode: camera mode to enter bindio: controls binding mode |
returns: current camera mode | Enter the vehicle with preferred camera mode |
virtual void exit() = 0; |
||
Parameter Description | Returns | Description |
---|---|---|
- | - | Return camera control to UFO controller |
virtual void fetch_controls(ifc_out coid::dynarray32<int32>& buf, bool append) = 0; |
||
Parameter Description | Returns | Description |
buf: captured input controls data append: true if data should be appended into the buffer, false for swap/set |
- | Fetch input controls data captured when vehicle was entered with ot::BindCapture |
virtual void apply_controls(const int32* cmd, uint ncmds) = 0; |
||
Parameter Description | Returns | Description |
cmd: input command array pointer returned from fetch_controls ncmds: number of commands in the array |
- | Apply input controls data |
virtual void pause(bool p) = 0; |
||
Parameter Description | Returns | Description |
p: pause/unpause simulation | - | Pause/unpause simulation |
virtual void remove_from_scene() = 0; |
||
Parameter Description | Returns | Description |
- | - | Remove from the scene |
virtual void set_visible(bool visible) = 0; |
||
Parameter Description | Returns | Description |
visible: show or hide the geom object | - | Show/hide whole geom object |
virtual bool is_visible() const = 0; |
||
Parameter Description | Returns | Description |
- | returns: true if the object is visible | Check if the object is visible |
virtual bool is_ready() const = 0; |
||
Parameter Description | Returns | Description |
- | returns: true if the geom is fully loaded | Check if the geom is fully loaded |
virtual bool is_persistent() const = 0; |
||
Parameter Description | Returns | Description |
- | returns: true if the object is persistent in the world | Check if the object is persistent in the world |
virtual bool is_script_error() const = 0; |
||
Parameter Description | Returns | Description |
- | returns: true if script loading failed and object can't get into the ready state | Check if script loading failed |
virtual bool is_script_enabled() const = 0; |
||
Parameter Description | Returns | Description |
- | returns: true if update_frame is enabled | Check if script update_frame is enabled |
virtual void enable_script(bool en) = 0; |
||
Parameter Description | Returns | Description |
en: enable or disable invocation of script update_frame | - | Enable/disable invocation of script update_frame |
virtual void commit() = 0; |
||
Parameter Description | Returns | Description |
- | - | Update object in cache, change to persistent if necessary (only effective on static objects) |
virtual void set_collision_group(uint group, uint mask) = 0; |
||
Parameter Description | Returns | Description |
group: collision group mask: collision mask |
- | Set collision group and mask |
virtual uint get_collision_group(ifc_out uint* mask) const = 0; |
||
Parameter Description | Returns | Description |
mask: optional mask value | returns: collision group id | Get collision group and mask |
virtual void extra_force(const float3& mpos, const float3& force, bool worldspace = false) = 0; |
||
Parameter Description | Returns | Description |
mpos: model-space position to act on force: model or world-space force vector worldspace: true for world-space, false for model-space force vector |
- | Add extra force to be applied to the object |
virtual void extra_impulse(const float3& mpos, const float3& impulse, bool worldspace = false) = 0; |
||
Parameter Description | Returns | Description |
mpos: model-space position to act on impulse: model or world-space force impulse vector worldspace: true for world-space, false for model-space force vector |
- | Apply extra force impulse (force * dt), one-time impulse, non-persistent |
virtual float3 com_offset() const = 0; |
||
Parameter Description | Returns | Description |
- | returns: current offset from model pivot to center of mass | Get current offset from model pivot to center of mass |
virtual btCollisionObject* collision_object() const = 0; |
||
Parameter Description | Returns | Description |
- | returns: the underlying physics collision object, if any | Get the underlying physics collision object, if any |