VU Community Forums

Vehicle information

Hi. Can anyone help me? I want to retrieve two pieces of information at a given moment:
1- The current speed of the vehicle my player is using;
2- Current camera mode while inside said vehicle (1st person/3rd person).

Assuming that you get a player somehow (eg. from an even) you can first check if he is in a vehicle:


Then I am assuming that the vehicle will be the:

which you can probably check if it is a vehicle (ControllableEntity.typeInfo.name). Then you need somehow to get it physics entity from where you can get the velocity. You can also see if your soldier exists while driving, and if it does, maybe you can get his velocity instead of the vehicle. As far as the camera is concerned, I have never use it…

Thanks mate. I got it to work with your suggestion. If anyone is interested the velocity property from controlledController is a vec3 containing x, y and z velocities. To get a resulting speed you just need the diagonal of the cuboid formed by the xyz vectors. Jets show a speed information in the cockpit view; I don’t know for sure the unit but it should be knots. To get the resulting speed I calculated to match the speed shown in the jet’s cockpit camera I had to multiply it by a factor of 3.595. I have no idea why tho, if anyone knows please share. Also I’m still trying to figure out the camera thing. In anyone knows I’d appreciate the help.

Based on some tests with moving objects around, the in-game dimensions seem to be in meters. Thus I would just guess that the velocities are in m/sec -> 3.6 km/h which seems responsable based on the vehicle velocities I have seen in game.

So that is probably your factor there, 3.6 :stuck_out_tongue:

About the camera, this will work on tanks but not on jets and choppers: (on client)

local m_tank3P = false
Hooks:Install(‘UI:PushScreen’, 100, function(hook, screen, priority, parentGraph, stateNodeGuid)
local screen = UIGraphAsset(screen)
m_tank3P = (screen.name == ‘UI/Flow/Screen/Vehicle/Tank3PCrosshair’)
end)

Thanks mate. Appreciated!