Jump to content

Weapon aiming camera


Recommended Posts

I decided to make some new weapon aiming cameras, I tried with setCameraMatrix in onClientPreRender and I failed.

Is there a way to do a first person aiming camera or putting the camera beside of the character?

With the camera beside of the character I mean like GTA 4.

Like this:

4683-gta-iv-jamaican-heat.jpg

p-escape2.jpg

tacticalcrosshair1ja9.jpg

Link to comment

I tried it with bone_attach resource, attaching a invisible object (setElementAlpha and setElementCollisionsEnabled) and getting its possition with onClientPreRender, but it still doesn't work. Any ideas?

EDIT:I also noticed when you use setCameraMatrix, your character can't move his crosshair, I don't know if it's a bug, but maybe what I want to do is impossible in MTA.

Link to comment

Actually, his next problem now is, the Aim problem, if he setCameraMatrix then he can't aim properly,

Look in the truefps resource and see how it works (if you take any script from it, then we can't help you if you need any! Unless you asked the resource pub.)

Link to comment
You can use these functions to draw the aim cursor
  
getPedTargetStart 
getScreenFromWorldPosition 
dxDrawImage 
  

Yes, I know it but the problem is that when you use setCameraMatrix, you can't target anything. Seems like setCameraMatrix locks the ped target. I hope you understand what I mean, because I don't speak english very often.

Link to comment
You can use these functions to draw the aim cursor
  
getPedTargetStart 
getScreenFromWorldPosition 
dxDrawImage 
  

Yes, I know it but the problem is that when you use setCameraMatrix, you can't target anything. Seems like setCameraMatrix locks the ped target. I hope you understand what I mean, because I don't speak english very often.

Check this resource by slothman and EvgeniZ and see how it works : https://community.multitheftauto.com/ind ... ls&id=1603

Link to comment

Nope, It won't work. I saw that resource and what it does is attach a object with alpha 0 behind of you that collides with your camera, pretending just zooming it in, but what I want is put the camera beside of the player, therefore it won't work.

Seems like MTA can't do this, I hope in the next version of MTA setCameraMatrix will have an argument that allows you to move your aim.

Like this:

  
bool setCameraMatrix ( player thePlayer, float positionX, float positionY, float positionZ [, float lookAtX, float lookAtY, float lookAtZ, float roll = 0, float fov = 70, bool ableToAim = false ] ) 
  

The bad news is that this is possible in SA-MP, because I did some script :(.

Link to comment
well, for the rotation, if your using setCameraMatrix, then your going to need the rotation, so if the player rotates you could keep the cam with the player.

Bump.

I know that, but the problem is when you use setCameraMatrix, your crosshair will be locked, you can't aim anything.

I saw the script truefps, but that it does is colliding the camera with an object, but what I need is to put the camera beside of the player.

I still need this, although it seems to be not possible in MTA, that the weird part.

Link to comment
well, for the rotation, if your using setCameraMatrix, then your going to need the rotation, so if the player rotates you could keep the cam with the player.

Bump.

I know that, but the problem is when you use setCameraMatrix, your crosshair will be locked, you can't aim anything.

I saw the script truefps, but that it does is colliding the camera with an object, but what I need is to put the camera beside of the player.

I still need this, although it seems to be not possible in MTA, that the weird part.

Then make the object beside the player and collide the camera to it !

Link to comment
and edit freecam for mouse movement. mta will not have a feature for moving mouse. setCameraMatrix is strictly for static cameras.

So what you said means that MTA isn't able to do it, and if there won't be functions for the camera, it'll never be possible with the current ones.

I give up with my script.

Link to comment

I said that setCameraMatrix will never have a feature for moving mouse. Freecam resource does this moving mouse (camera and player too!), all you have to do is remove the movement of camera and only the mouse movement left. Why not do some REAL work instead of relying on the functions MTA make?

Link to comment
I said that setCameraMatrix will never have a feature for moving mouse. Freecam resource does this moving mouse (camera and player too!), all you have to do is remove the movement of camera and only the mouse movement left. Why not do some REAL work instead of relying on the functions MTA make?

What do you think freecam resource does? It uses setCameraMatrix to do the movement/rotation with events. All you need to know is 3D maths to calculate coords of the camera's position and the look-at coords. I made myself a custom camera resource, which imitated the camera used by GTA but due to GTA engine the coords of the player during animations aren't well synched so I dropped the project. Almost anything is possible in MTA, the only limit is your imagination. Of course there are things which you can't do but sometimes there are workarounds.

@Sharingan, while you're doing custom camera, you could also make custom aim system (zoom in/out - FOV or closer camera position, overlay image to simulate looking down the sight like in FPS, etc.). That's a lot of work though.

Link to comment
  • 4 months later...

Sorry for bumping, but I got back with this unfinished business.

I checked freecam script but it's not possible to force a player to aim somewhere or something, so with animations and changing ped rotation you can't. Freecam it's just a flying camera, but nothing to do with the player. I can attach the camera with bone functions to the player but the player will never be able to aim because the lack of this functions.

I wanted to do a more accurate shooting system than the current one for a RP project.

Thanks for your answers, and I apologize for earlier, I was a little upset.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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