megaman54 Posted October 24, 2010 Share Posted October 24, 2010 Hi! Is it possible to make a flashlight script, that you point your flashlight somewhere and it creates light there? I'm not requesting you to do this for me i'm just asking is it possible and if it is, then how to do it. Link to comment
dzek (varez) Posted October 24, 2010 Share Posted October 24, 2010 hmm, you can create and move a corona marker to the point that player is aiming. but afair - player needs to click somewhere so you could get world position of click - which makes it impossible to move while moving mouse.. not sure about it anyway - maybe there is a chance to get aim world position. Link to comment
megaman54 Posted October 24, 2010 Author Share Posted October 24, 2010 Ok, thanks. I will try it as i have a script where you press I and it brings cursor to your screen and when you click somewhere it will create explosion there, i just change the explosion to marker or corona or whatever Link to comment
DiSaMe Posted October 24, 2010 Share Posted October 24, 2010 hmm, you can create and move a corona marker to the point that player is aiming. but afair - player needs to click somewhere so you could get world position of click - which makes it impossible to move while moving mouse..not sure about it anyway - maybe there is a chance to get aim world position. getWorldFromScreenPosition and processLineOfSight can be used to get world position without clicking. Link to comment
dzek (varez) Posted October 24, 2010 Share Posted October 24, 2010 is the sight of the gun always in the center of screen? you need to pass something to getWorldFromScreenPosition, i think passing center point will be ok Link to comment
DiSaMe Posted October 24, 2010 Share Posted October 24, 2010 is the sight of the gun always in the center of screen?you need to pass something to getWorldFromScreenPosition, i think passing center point will be ok It's not the center, but near the center and it does not change. Link to comment
dzek (varez) Posted October 24, 2010 Share Posted October 24, 2010 and when the resolution dimensions ratio is different? are the relative values the same? Link to comment
Puma Posted October 24, 2010 Share Posted October 24, 2010 First thing that comes into my mind is combining the position of a player's bones with LineOfSight. Detailed: A gun is just an object that is attached to one of the bones of a player (the hand, in this case). If you know the position of the elbow of that arm ánd the hand, you can use those two positions to calculate a line as an extension of the line that the positions of the elbow and hand create, directed from the elbow to the hand. If you extend that line by, for example, 10 meters and use the position 10 meters "in front of the hand", you could process a line of sight to check if it hits something. If it does, move the marker to that position. If you repeat this calculation on onClientPreRender, this might work. Again, it's just an idea: this is how I would try it. [EEEEEEEEDIEET] Here's a nice drawing btw: Hope you get what I mean. Useful links: https://wiki.multitheftauto.com/wiki/GetPedBonePosition (to get the two positions) https://wiki.multitheftauto.com/wiki/ProcessLineOfSight (to get a hit position) Link to comment
eAi Posted October 24, 2010 Share Posted October 24, 2010 This is, of course, how GTA calculates what you're going to hit when you fire a weapon. You can see how MTA calculates the shot target here - this generally matches how GTA does it: http://www.google.com/codesearch/p?hl=e ... =rc&l=3971 Maybe this is something that could be exposed to scripts... 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