I don't know how to explain this, exactly...
It's complex for me.
So I will just say:
I want the camera to move as in TrackMania Nations Forever (while on stunts, check 0:10)
BUT without using a FPS mode.
I've got my script working this way:
So, can I fix it?
Here's my code if you can add some improvement/wanna have it lol (I was planning to make this script public, as a Race Addon)
function getPointFromDistanceRotation ( x, y, dist, angle )
--Function made by "robhol"
local a = math.rad ( 90 + angle )
local dx = math.cos ( a ) * dist
local dy = math.sin ( a ) * dist
return x + dx, y + dy
end
player = getLocalPlayer ( )
--This script will only work while using vehicles!
function setTrackmaniaCamera ( )
if not isPedInVehicle ( player ) then
if getCameraTarget ( ) ~= player then setCameraTarget ( player, player ) end
return
end
local v = getPedOccupiedVehicle ( player )
local px, py, pz = getElementPosition ( v )
local prx, pry, prz = getElementRotation ( v )
local csx, csy = getPointFromDistanceRotation ( px, py, 10, prz - 180 )
local csz = getPointFromDistanceRotation ( pz, px, 10, pry - 30 )
local ctx, cty = getPointFromDistanceRotation ( px, py, 5, prz )
local ctz = getPointFromDistanceRotation ( pz, px, 10, prx - 180 )
setCameraMatrix ( csx, csy, csz, ctx, cty, ctz, -pry )
return true
end
addEventHandler ( "onClientPreRender", getRootElement ( ), setTrackmaniaCamera )
NOTE: Yes, I made a Race DM map and called it that way