Object

Struct Object 

Source
pub struct Object { /* private fields */ }

Implementations§

Source§

impl Object

Source

pub fn get_handle(&self) -> *const c_void

Source

pub fn new(handle: *const c_void) -> Self

Source

pub fn create( modelid: i32, position: Vector3, rotation: Vector3, draw_distance: f32, ) -> Option<Object>

Creates an object at specified coordinates in the game world.

Source

pub fn destroy(&self)

Destroys (removes) an object that was created using create method.

Source

pub fn attach_to_vehicle( &self, vehicle: &Vehicle, offset: Vector3, rotation: Vector3, ) -> bool

Attach an object to a vehicle.

Source

pub fn attach_to_object( &self, obj_attached_to: &Object, offset: Vector3, rotation: Vector3, sync_rotation: bool, ) -> bool

Attach an object to an object.

Source

pub fn attach_to_player( &self, player: &Player, offset: Vector3, rotation: Vector3, ) -> bool

Attach a player object to a player.

Source

pub fn set_pos(&self, position: Vector3) -> bool

Set the position of an object.

Source

pub fn get_pos(&self) -> Vector3

Locate an object.

Source

pub fn set_rotation(&self, rotation: Vector3) -> bool

Set the rotation of an object.

Source

pub fn get_rotation(&self) -> Vector3

Get the rotation of an object.

Source

pub fn get_model(&self) -> i32

Get the model ID of an object

Source

pub fn set_no_camera_collision(&self) -> bool

Disable collisions between players’ cameras and the specified object.

Source

pub fn move_object(&self, data: ObjectMoveData) -> i32

Move an object to a new position with a set speed. Players/vehicles will ‘surf’ the object as it moves.

Source

pub fn stop(&self) -> bool

Stop an object from moving.

Source

pub fn is_moving(&self) -> bool

Check if the object is moving.

Source

pub fn set_material( &self, material_index: i32, model_id: i32, texture_library: &str, texture_name: &str, material_colour: Colour, ) -> bool

Replace the texture of an object with the texture from another model in the game.

Source

pub fn set_material_text( &self, text: &str, material_index: i32, material_size: ObjectMaterialSize, fontface: &str, fontsize: i32, bold: bool, font_colour: Colour, background_colour: Colour, textalignment: ObjectMaterialTextAlign, ) -> bool

Replace the texture of an object with text.

Source

pub fn set_objects_default_camera_collision(disable: bool) -> bool

Allows camera collisions with newly created objects to be disabled by default.

Source

pub fn get_draw_distance(&self) -> f32

Get the draw distance of an object.

Source

pub fn get_move_speed(&self) -> f32

Get the move speed of an object.

Source

pub fn get_move_data(&self) -> ObjectMoveData

Get the move data of an object.

Source

pub fn get_attached_data(&self) -> ObjectAttachmentData

Get the attachment data of an object.

Source

pub fn is_material_slot_used(&self, material_index: i32) -> bool

Checks if a slot of object material is used.

Source

pub fn get_material_data(&self, material_index: i32) -> ObjectMaterialData

Get object’s material data

Source

pub fn is_no_camera_collision(&self) -> bool

Check if collisions between players’ cameras and the specified object is disabled.

Source

pub fn get_id(&self) -> i32

Get object’s id

Source

pub fn from_id(id: i32) -> Option<Object>

Get Object from an id

Auto Trait Implementations§

§

impl Freeze for Object

§

impl RefUnwindSafe for Object

§

impl !Send for Object

§

impl !Sync for Object

§

impl Unpin for Object

§

impl UnwindSafe for Object

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.