GetVehicleSkeletalMeshComponent: Difference between revisions

From Onset Developer Wiki
(Created page with "{{Info|Function|Client|1.0}} {{FuncDescription|Gets the skeletal mesh component of a vehicle.}} {{FuncSyntax|GetVehicleSkeletalMeshComponent(vehicle)}} {{FuncParameters}} {...")
 
No edit summary
 
Line 41: Line 41:


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
*[[SetVehiclePropertyValue]]
*[[GetVehiclePropertyValue]]
*[[GetVehicleCount]]
*[[GetVehicleLicensePlate]]
*[[IsValidVehicle]]
*[[GetStreamedVehicles]]
*[[GetVehicleBoneLocation]]
*[[GetVehicleBoneNames]]
*[[GetVehicleModel]]
*[[GetVehicleLocation]]
*[[GetVehicleRotation]]
*[[GetVehicleVelocity]]
*[[GetVehicleForwardVector]]
*[[GetVehicleRightVector]]
*[[GetVehicleUpVector]]
*[[GetVehicleBoundingBox]]
*[[GetVehicleEngineRPM]]
*[[GetVehicleForwardSpeed]]
*[[GetVehicleGear]]
*[[GetVehicleWheelSurface]]
*[[IsVehicleWheelInAir]]
*[[IsVehicleInAir]]
*[[GetVehicleWheelSteerAngle]]
*[[IsVehicleHornActive]]
*[[GetVehicleEngineState]]
*[[GetVehicleLightState]]
*[[GetVehicleHoodRatio]]
*[[GetVehicleTrunkRatio]]
*[[IsVehicleInWater]]
*[[IsVehicleSeatOccupied]]
*[[GetVehicleDoorLocation]]
*[[GetVehicleHealth]]
*[[GetVehicleSkeletalMeshComponent]]

Latest revision as of 14:43, 23 December 2020

GetVehicleSkeletalMeshComponent

Type: Function
Context: Client
Introduced: v1.0

Description

Gets the skeletal mesh component of a vehicle.

Syntax

GetVehicleSkeletalMeshComponent(vehicle)

Parameters

  • vehicle
    The vehicle identifier.

Return Value

  • Returns USkeletalMeshComponent and then can be used by UnrealLua.

Example

local function OnKeyPress(key)
	local vehicle = GetPlayerVehicle(GetPlayerId())
	if vehicle ~= 0 then
		local VehicleSkeletalMeshComponent = GetVehicleSkeletalMeshComponent(vehicle)
		if GetVehicleDriver(vehicle) == GetPlayerId() then
			if key == 'H' then
				VehicleSkeletalMeshComponent:SetPhysicsLinearVelocity(FVector(0.0, 0.0, 800.0), true)
			end
			
			if (key == '2' or key == 'é') then
				VehicleSkeletalMeshComponent:SetPhysicsLinearVelocity(FVector(0.0, 0.0, 0.0), false)
				VehicleSkeletalMeshComponent:SetPhysicsAngularVelocityInDegrees(FVector(0.0, 0.0, 0.0), false)
			end
			
			if key == "Left Mouse Button" then
				local x, y, z = GetVehicleVelocity(vehicle)
			    local size = x * x + y * y + z * z
				if (size < 25000000) then
					local mult = 0.3
					VehicleSkeletalMeshComponent:SetPhysicsLinearVelocity(FVector(x * mult, y * mult, z * mult), true)
				end
			end
	    end
	end
end
AddEvent("OnKeyPress", OnKeyPress)

See also