Jump to content

Need functions to control the firing point on the vertical axis


stm

Recommended Posts

I do custom camera control.

  • tracking mouse movement in onClientCursorMove
  • modify the camera position in onClientPreRender

change the camera position setCameraMatrix

localPlayer turn in the direction of the camera using setElementRotation,

set direction to target setCameraTarget( targetX, target, target )

at the same time visually the model directs the weapon in the right direction,

but the shooting is not in this direction but strictly forward

for the horizontal plane, this is not critical because in this plane the direction of the player and the camera are the same,

but for the vertical plane this is not the case, the obvious solution to rotate the player in the vertical plane leads to 2 problems:

  1. at significant angles difficult movement of the player
  2. it is not possible to use this mechanism for a third-person regime

Need a function that allows you to set the direction of fire.
it could be setCameraTarget, if it changed not only the visual direction, but the actual direction of the fire.

Or a separate function allows you to set the angle of fire in the vertical plane.

I would also like to be able to set for the camera not only FOV but also AspectRatio, NearClip, FarClip

Link to comment
https://github.com/multitheftauto/mtasa-blue/blob/2918d952c50b10553286e5a6c7bbbcd391ac206d/Client/mods/deathmatch/logic/CClientPed.cpp#L4772

https://github.com/multitheftauto/mtasa-blue/blob/2918d952c50b10553286e5a6c7bbbcd391ac206d/Client/mods/deathmatch/logic/CClientPed.cpp#L4772
It may be sufficient here to change the computation of the vector vecTarget

vecTarget = CVector(vecOrigin.fX + (vecTemp.fX * fRange), vecOrigin.fY + (vecTemp.fY * fRange), vecOrigin.fZ);

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...