Sharingan Posted July 15, 2012 Share Posted July 15, 2012 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: Link to comment
Jaysds1 Posted July 15, 2012 Share Posted July 15, 2012 well, you could get the getPedBonePosition which is the hand then set the camera back minus ing by a whole number. After, all you have to do is detect the players movement, and aim. Link to comment
Sharingan Posted July 15, 2012 Author Share Posted July 15, 2012 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
Al3grab Posted July 16, 2012 Share Posted July 16, 2012 use something like local x,y,z = getPedBonePosition(localPlayer,25) setCameraMatrix(x-2,y-2,z,x,y,z) Link to comment
Jaysds1 Posted July 16, 2012 Share Posted July 16, 2012 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
Al3grab Posted July 16, 2012 Share Posted July 16, 2012 He can't use the normal aim system so he will need to make custom one Link to comment
Sharingan Posted July 17, 2012 Author Share Posted July 17, 2012 He can't use the normal aim system so he will need to make custom one Can you give some idea how I can do it? I'm new here, sorry. MTA has so many features, I'm not used to script in Lua yet. Link to comment
Al3grab Posted July 17, 2012 Share Posted July 17, 2012 You can use these functions to draw the aim cursor getPedTargetStart getScreenFromWorldPosition dxDrawImage Link to comment
Sharingan Posted July 17, 2012 Author Share Posted July 17, 2012 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
Al3grab Posted July 17, 2012 Share Posted July 17, 2012 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
Sharingan Posted July 17, 2012 Author Share Posted July 17, 2012 Ok, I'm gonna try it out. Link to comment
Sharingan Posted July 17, 2012 Author Share Posted July 17, 2012 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
arezu Posted July 18, 2012 Share Posted July 18, 2012 You can do this in MTA.. try with setPedAimTarget and maybe also setPedRotation Link to comment
Sharingan Posted July 18, 2012 Author Share Posted July 18, 2012 According to the wiki, setPedAimTarget won't work with the local player. And setPedRotation just sets the ped angle from 0 to 360. Link to comment
Jaysds1 Posted July 19, 2012 Share Posted July 19, 2012 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. Link to comment
Sharingan Posted July 25, 2012 Author Share Posted July 25, 2012 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
Al3grab Posted July 25, 2012 Share Posted July 25, 2012 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
qaisjp Posted July 25, 2012 Share Posted July 25, 2012 and edit freecam for mouse movement. mta will not have a feature for moving mouse. setCameraMatrix is strictly for static cameras. Link to comment
Sharingan Posted July 27, 2012 Author Share Posted July 27, 2012 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
qaisjp Posted July 27, 2012 Share Posted July 27, 2012 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
50p Posted July 27, 2012 Share Posted July 27, 2012 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
qaisjp Posted July 27, 2012 Share Posted July 27, 2012 He wants a function like this, 50p: setCameraMatrix(...., book movable) I told him to modify freecam for what he needed. I told hi that function edit will never exist Link to comment
Sharingan Posted December 9, 2012 Author Share Posted December 9, 2012 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
Sharingan Posted December 11, 2012 Author Share Posted December 11, 2012 OK, it seems like nobody is gonna help me with my problem. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now