pub struct Object { /* private fields */ }Implementations§
Source§impl Object
impl Object
pub fn get_handle(&self) -> *const c_void
pub fn new(handle: *const c_void) -> Self
Sourcepub fn create(
modelid: i32,
position: Vector3,
rotation: Vector3,
draw_distance: f32,
) -> Option<Object>
pub fn create( modelid: i32, position: Vector3, rotation: Vector3, draw_distance: f32, ) -> Option<Object>
Creates an object at specified coordinates in the game world.
Sourcepub fn attach_to_vehicle(
&self,
vehicle: &Vehicle,
offset: Vector3,
rotation: Vector3,
) -> bool
pub fn attach_to_vehicle( &self, vehicle: &Vehicle, offset: Vector3, rotation: Vector3, ) -> bool
Attach an object to a vehicle.
Sourcepub fn attach_to_object(
&self,
obj_attached_to: &Object,
offset: Vector3,
rotation: Vector3,
sync_rotation: bool,
) -> bool
pub fn attach_to_object( &self, obj_attached_to: &Object, offset: Vector3, rotation: Vector3, sync_rotation: bool, ) -> bool
Attach an object to an object.
Sourcepub fn attach_to_player(
&self,
player: &Player,
offset: Vector3,
rotation: Vector3,
) -> bool
pub fn attach_to_player( &self, player: &Player, offset: Vector3, rotation: Vector3, ) -> bool
Attach a player object to a player.
Sourcepub fn set_rotation(&self, rotation: Vector3) -> bool
pub fn set_rotation(&self, rotation: Vector3) -> bool
Set the rotation of an object.
Sourcepub fn get_rotation(&self) -> Vector3
pub fn get_rotation(&self) -> Vector3
Get the rotation of an object.
Sourcepub fn set_no_camera_collision(&self) -> bool
pub fn set_no_camera_collision(&self) -> bool
Disable collisions between players’ cameras and the specified object.
Sourcepub fn move_object(&self, data: ObjectMoveData) -> i32
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.
Sourcepub fn set_material(
&self,
material_index: i32,
model_id: i32,
texture_library: &str,
texture_name: &str,
material_colour: Colour,
) -> bool
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.
Sourcepub 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
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.
Sourcepub fn set_objects_default_camera_collision(disable: bool) -> bool
pub fn set_objects_default_camera_collision(disable: bool) -> bool
Allows camera collisions with newly created objects to be disabled by default.
Sourcepub fn get_draw_distance(&self) -> f32
pub fn get_draw_distance(&self) -> f32
Get the draw distance of an object.
Sourcepub fn get_move_speed(&self) -> f32
pub fn get_move_speed(&self) -> f32
Get the move speed of an object.
Sourcepub fn get_move_data(&self) -> ObjectMoveData
pub fn get_move_data(&self) -> ObjectMoveData
Get the move data of an object.
Sourcepub fn get_attached_data(&self) -> ObjectAttachmentData
pub fn get_attached_data(&self) -> ObjectAttachmentData
Get the attachment data of an object.
Sourcepub fn is_material_slot_used(&self, material_index: i32) -> bool
pub fn is_material_slot_used(&self, material_index: i32) -> bool
Checks if a slot of object material is used.
Sourcepub fn get_material_data(&self, material_index: i32) -> ObjectMaterialData
pub fn get_material_data(&self, material_index: i32) -> ObjectMaterialData
Get object’s material data
Sourcepub fn is_no_camera_collision(&self) -> bool
pub fn is_no_camera_collision(&self) -> bool
Check if collisions between players’ cameras and the specified object is disabled.