Jump to content

Przemcio

Members
  • Posts

    29
  • Joined

  • Last visited

Everything posted by Przemcio

  1. Works like a charm, thank you, problem solved! But I think it should be ultimately divided by line thickness instead of multiplied - at least that's how I got these calculations right. If anyone wondering: dxDrawMaterialSectionLine3D(x, y, z, x, y, liftZ + liftHeight, 0, 0, 16, ((64 * ((z - liftZ) + liftHeight)) / (64 / 16)) / 0.1, misc.chainTexture, 0.1)
  2. Hello, I'm trying to achieve something like this: But it's an object and I need a 3D line looking similar to that. Got no clue how to draw a 3D line without stretching the texture (or if it's even possible, but I don't think it's not). My latest attempt code and result: misc.chainTexture = dxCreateTexture(download.getAssetId("asset/texture/Chain.dds"), "dxt5", false, "mirror") -- Lifts chains for i = 1, #misc.liftData do if(isElementStreamedIn(misc.liftData[i]["cranesObject"]) == true or isElementStreamedIn(misc.liftData[i]["liftObject"]) == true) then local cranesVerticalOffset = 2.9499983787537 local liftHeight = 2.7499985694885 local _, _, liftZ = getElementPosition(misc.liftData[i]["liftObject"]) local x, y, z = utils.getPositionFromElementOffset(misc.liftData[i]["cranesObject"], -1.2499998807907, -0.049999993294477, cranesVerticalOffset) dxDrawMaterialSectionLine3D(x, y, z, x, y, liftZ + liftHeight, 0, 0, 1, 1, misc.chainTexture, 0.1) x, y, z = utils.getPositionFromElementOffset(misc.liftData[i]["cranesObject"], 1.1499999761581, -0.049999993294477, cranesVerticalOffset) -- second chain will go there, eventually end end Texture: Result: Couldn't find any script doing anything similar, don't know even where to start - if I messed up texture creation, or dxDraw function, or both (most likely the last). Tried dxDrawMaterialLine3D either - similar effect, a little better, though I'm not sure what I really did with the dxDrawMaterialSectionLine3D just tried to do anything from example code from documentation. Thanks!
  3. Hey, I noticed getColorFilter on wiki added to the version in the title, but I'm not able to update the client - I'm using stable version, not really into nightly. I thought that function on wiki means it's in the stable version of the game already, but seems like it's not the case now. Is it going to be available soon, or it's an issue with my MTA? Need this function so bad, funny enough, I was thinking if you're going to add it (following setGrainLevel, which I also craved) just a couple of days ago, seems like my prayers has been answered : D
  4. It's a custom object, if you want to achieve similar effect, you'd need create or get an engine model, put it into MTA, then attach it to the vehicle (cause there's no engine as an object natively), the engine position can be retrieved by getVehicleDummyPosition with "engine" as a second argument. I assume you know how to use shader to outline the object.
  5. Hey, It's a pretty hard issue to reproduce, but sometimes (legendary rare tier) when MTA is downloading files through downloadFile, the file appears as taken by a process (most likely MTA itself), so it's practically unusable until you stop the MTA, that's when the file is "released" and can be used/modified/whatever. onClientFileDownloadComplete returns success as true to these files. Is there any way to "release" the file manually? I've tried using Lua's garbagecollector, it does work when I simulate the issue through unclosing the file after fileOpen, but seems like it doesn't when this particual issue happens. If anyone happened to cross the issue, how did you manage to overcome it? I can't even try to download the file again, as it's protected by a process. Thanks!
  6. Fixed the issue. If anyone run into this problem, here's what worked for me: 1. Create a shortcut for MTA client 2. RMB -> Properties 3. Now I'll just paste a screenshot, it's in polish, but you should figure it out easily regardless of your language:
  7. Hey, I've got an issue with MTA windowed mode being to small. I have a 4K display and previously, MTA run in windowed mode in 1080p was something like that large: This screenshot has been taken in 1440p. But when I run it in 1080p like always, it's small as hell: It wouldn't be a big issue, but I didn't implemented UI scaling in my mod yet, so it looks too small in 1440p. Tried reinstalling MTA completely, running it in DPI aware mode, scaling Windows to 200% - nothing seems to work, any ideas? Thanks!
  8. The mod is under total UI redesign now, as it was surely its weakest point, majority of the overhaul is done already (at least the worst ones to redesign). Along with the UI overhaul, I've "unharcoded" every word, so translations will be easy to do and I've also optimized the UI in general. Here's how it looks like: Login panel: Character creator: HUD: Inventory: Attributes tab in dashboard: Attribute description popup: Also, you may want to see how login panel looks "in action", cause there are some animations too ; )
  9. Seems like you're using wrong angles order, try "ZXY" - it's for objects. For more information refer to setElementRotation (rotOrder optional argument).
  10. onClientClick (clickedWorld) + onClientCursorMove.
  11. That would be nice! Is there any way to... vote for things like that or something?
  12. Yeah, just create many "gunsmoke" effects and it will disappear. Don't ask, it just works.
  13. Hello! When it's raining, there's a "smoke" (don't know how to define it better) appearing on the ground, I know I can make a custom rain, but I'd really want to make it performance friendly, so everyone can have similar experience. Maybe there is someone, who found a way how to get rid of that? There's a couple of solutions I've came up with, but they're far from ideal: 1. Remove "bullethitsmoke" texture - probably the best idea, but unfortunately, it's also removing many other effects, which I really don't want to be removed, 2. setRainLevel to some high value - the "smoke" in fact disappears, but there's so much film grain effect, that the screen become barely visible, especially at night (perhaps there is a way to remove the film grain?), 3. setWindVelocity with -100 on Z velocity - smoke disappears into the ground, but rain drops are now more like rain lines, which looks almost as bad as rain in Definitive Edition (unless it was fixed - don't know). Anyone have any ideas? Thanks! //Edit Just found some really, really weird possible solution, the smoke dissapears when I shoot a gun (XD?). Going to experiment with that more then.
  14. Just finished advanced weather system, I guarantee MTA: SA wasn't that atmospheric before ; )!
  15. I'm just using setSkyGradient + setFogDistance - no need for any shaders in that case : D
  16. Thank you for your opinion ; ) As for the performance, every power-hungry features like decals and smoke can be turned off, there are just two exceptions, that may be an issue - flashlight, it needs to be a custom light, cause nights are darker than normal, GTA:SA's lighting won't work there, and PTSD effects. I don't think that things like recoil, aiming shake or custom damage system would be a big problem for low end systems though, it's just a bunch of calculations. Unfortunately, I don't have access to a very old PC, the oldest one that I have is a laptop with GTX 850m and it works fine there : p If you're interested in more, I've started to make some short videos: Custom grenades Fast travel Out of bounds event (you can see how much time I put in making an atmosphere there : D)
  17. Okay got it, just my maths, like always XD In case someone need it - you need to absolute the result of X - X1/Y - Y1, not X/Y and X1/Y1 themselves, like I did in my code, cause if there are sectors in other extenses, you'll get too low (or even 0) values of width/height.
  18. Hello! I'm trying to fill San Fierro with radar zones with createRadarArea using map.zon file from GTA: SA's data folder. According to this, districts coord in map.zon are usually starting from lower left corner and usually ends at upper right, and it's exactly my issue. As map.zon file doesn't have clear districts names, I've dwelled into the code of MTA: SA and found this, then I've made a simple script to automate the work for me: local districts = { {-2741, 1268, 0, -2533, 1490, 200, "Battery Point"}, {-2741, 1659, 0, -2616, 2175, 200, "Gant Bridge"}, {-2741, 1490, 0, -2616, 1659, 200, "Gant Bridge"}, {-1339, 828, -89, -1213, 1057, 110, "Garver Bridge"}, {-1213, 950, -89, -1087, 1178, 110, "Garver Bridge"}, {-1499, 696, -179, -1339, 925, 20, "Garver Bridge"}, {-2533, 968, 0, -2274, 1358, 200, "Juniper Hollow"}, {-2741, 793, 0, -2533, 1268, 200, "Paradiso"}, {-2533, 1358, 0, -1996, 1501, 200, "Esplanade North"}, {-1996, 1358, 0, -1524, 1592, 200, "Esplanade North"}, {-1982, 1274, 0, -1524, 1358, 200, "Esplanade North"}, {-1620, 1176, 0, -1580, 1274, 200, "Esplanade East"}, {-1580, 1025, 0, -1499, 1274, 200, "Esplanade East"}, {-1499, 578, -79, -1339, 1274, 20, "Esplanade East"}, {-1871, 744, 0, -1701, 1176, 300, "Financial"}, {-2274, 744, 0, -1982, 1358, 200, "Calton Heights"}, {-2274, 578, 0, -2078, 744, 200, "Chinatown"}, {-2533, 578, 0, -2274, 968, 200, "Juniper Hill"}, {-2994, 458, 0, -2741, 1339, 200, "Palisades"}, {-2741, 458, 0, -2533, 793, 200, "Santa Flora"}, {-2867, 277, 0, -2593, 458, 200, "City Hall"}, {-2533, 458, 0, -2329, 578, 200, "Queens"}, {-2593, 54, 0, -2411, 458, 200, "Queens"}, {-2411, 373, 0, -2253, 458, 200, "Queens"}, {-2329, 458, 0, -1993, 578, 200, "King's"}, {-2411, 265, 0, -1993, 373, 200, "King's"}, {-2253, 373, 0, -1993, 458, 200, "King's"}, {-1794, 249, 0, -1242, 578, 200, "Easter Basin"}, {-1794, -50, 0, -1499, 249, 200, "Easter Basin"}, {-2270, -324, 0, -1794, -222, 200, "Doherty"}, {-2173, -222, 0, -1794, 265, 200, "Doherty"}, {-2007, 56, 0, -1922, 224, 100, "Cranberry Station"}, {-2411, -222, 0, -2173, 265, 200, "Garcia"}, {-2395, -222, 0, -2354, -204, 200, "Garcia"}, {-2593, -222, 0, -2411, 54, 200, "Hashbury"}, {-2994, 277, 0, -2867, 458, 200, "Ocean Flats"}, {-2994, -222, 0, -2593, 277, 200, "Ocean Flats"}, {-2994, -430, 0, -2831, -222, 200, "Ocean Flats"}, {-2646, -355, 0, -2270, -222, 200, "Avispa Country Club"}, {-2831, -430, 0, -2646, -222, 200, "Avispa Country Club"}, {-2361, -417, 0, -2270, -355, 200, "Avispa Country Club"}, {-2667, -302, -28, -2646, -262, 71, "Avispa Country Club"}, {-2470, -355, 0, -2270, -318, 46, "Avispa Country Club"}, {-2550, -355, 0, -2470, -318, 39, "Avispa Country Club"}, {-2994, -811, 0, -2178, -430, 200, "Missionary Hill"}, {-2270, -430, 0, -2178, -324, 200, "Foster Valley"}, {-2178, -599, 0, -1794, -324, 200, "Foster Valley"}, {-2178, -1115, 0, -1794, -599, 200, "Foster Valley"}, {-2178, -1250, 0, -1794, -1115, 200, "Foster Valley"}, {-1499, -50, 0, -1242, 249, 200, "Easter Bay Airport"}, {-1982, 744, 0, -1871, 1274, 200, "Downtown"}, {-1871, 1176, 0, -1620, 1274, 200, "Downtown"}, {-1700, 744, 0, -1580, 1176, 200, "Downtown"}, {-1580, 744, 0, -1499, 1025, 200, "Downtown"}, {-2078, 578, 0, -1499, 744, 200, "Downtown"}, {-1993, 265, 0, -1794, 578, 200, "Downtown"} } local file = fileOpen("output.lua", false) for i = 1, #districts do fileWrite(file, "createRadarArea(" .. tostring(districts[i][1]) .. ", " .. tostring(districts[i][2]) .. ", " .. tostring(math.abs(districts[i][1]) - math.abs(districts[i][4])) .. ", " .. tostring(math.abs(districts[i][2]) - math.abs(districts[i][5])) .. ", " .. tostring(math.random(255)) .. ", " .. tostring(math.random(255)) .. ", " .. tostring(math.random(255)) .. ", 255) -- " .. districts[i][7] .. "\n") end fileClose(file) And the output is this: createRadarArea(-2741, 1268, 208, -222, 215, 177, 102, 255) -- Battery Point createRadarArea(-2741, 1659, 125, -516, 67, 2, 135, 255) -- Gant Bridge createRadarArea(-2741, 1490, 125, -169, 244, 102, 62, 255) -- Gant Bridge createRadarArea(-1339, 828, 126, -229, 150, 66, 175, 255) -- Garver Bridge createRadarArea(-1213, 950, 126, -228, 242, 112, 228, 255) -- Garver Bridge createRadarArea(-1499, 696, 160, -229, 2, 240, 154, 255) -- Garver Bridge createRadarArea(-2533, 968, 259, -390, 201, 148, 37, 255) -- Juniper Hollow createRadarArea(-2741, 793, 208, -475, 57, 98, 2, 255) -- Paradiso createRadarArea(-2533, 1358, 537, -143, 107, 21, 169, 255) -- Esplanade North createRadarArea(-1996, 1358, 472, -234, 219, 17, 207, 255) -- Esplanade North createRadarArea(-1982, 1274, 458, -84, 169, 177, 205, 255) -- Esplanade North createRadarArea(-1620, 1176, 40, -98, 136, 175, 37, 255) -- Esplanade East createRadarArea(-1580, 1025, 81, -249, 176, 186, 199, 255) -- Esplanade East createRadarArea(-1499, 578, 160, -696, 8, 222, 165, 255) -- Esplanade East createRadarArea(-1871, 744, 170, -432, 181, 22, 141, 255) -- Financial createRadarArea(-2274, 744, 292, -614, 242, 15, 71, 255) -- Calton Heights createRadarArea(-2274, 578, 196, -166, 38, 251, 159, 255) -- Chinatown createRadarArea(-2533, 578, 259, -390, 75, 236, 94, 255) -- Juniper Hill createRadarArea(-2994, 458, 253, -881, 178, 56, 40, 255) -- Palisades createRadarArea(-2741, 458, 208, -335, 62, 133, 231, 255) -- Santa Flora createRadarArea(-2867, 277, 274, -181, 28, 231, 113, 255) -- City Hall createRadarArea(-2533, 458, 204, -120, 21, 200, 44, 255) -- Queens createRadarArea(-2593, 54, 182, -404, 249, 198, 222, 255) -- Queens createRadarArea(-2411, 373, 158, -85, 54, 117, 1, 255) -- Queens createRadarArea(-2329, 458, 336, -120, 192, 30, 104, 255) -- King's createRadarArea(-2411, 265, 418, -108, 80, 254, 10, 255) -- King's createRadarArea(-2253, 373, 260, -85, 65, 49, 64, 255) -- King's createRadarArea(-1794, 249, 552, -329, 40, 159, 226, 255) -- Easter Basin createRadarArea(-1794, -50, 295, -199, 240, 50, 199, 255) -- Easter Basin createRadarArea(-2270, -324, 476, 102, 165, 168, 232, 255) -- Doherty createRadarArea(-2173, -222, 379, -43, 117, 235, 170, 255) -- Doherty createRadarArea(-2007, 56, 85, -168, 39, 163, 146, 255) -- Cranberry Station createRadarArea(-2411, -222, 238, -43, 108, 241, 138, 255) -- Garcia createRadarArea(-2395, -222, 41, 18, 148, 137, 66, 255) -- Garcia createRadarArea(-2593, -222, 182, 168, 102, 90, 10, 255) -- Hashbury createRadarArea(-2994, 277, 127, -181, 203, 51, 18, 255) -- Ocean Flats createRadarArea(-2994, -222, 401, -55, 100, 151, 19, 255) -- Ocean Flats createRadarArea(-2994, -430, 163, 208, 51, 40, 165, 255) -- Ocean Flats createRadarArea(-2646, -355, 376, 133, 116, 155, 178, 255) -- Avispa Country Club createRadarArea(-2831, -430, 185, 208, 113, 175, 102, 255) -- Avispa Country Club createRadarArea(-2361, -417, 91, 62, 214, 152, 51, 255) -- Avispa Country Club createRadarArea(-2667, -302, 21, 40, 243, 224, 100, 255) -- Avispa Country Club createRadarArea(-2470, -355, 200, 37, 252, 48, 229, 255) -- Avispa Country Club createRadarArea(-2550, -355, 80, 37, 147, 113, 160, 255) -- Avispa Country Club createRadarArea(-2994, -811, 816, 381, 181, 13, 73, 255) -- Missionary Hill createRadarArea(-2270, -430, 92, 106, 67, 104, 229, 255) -- Foster Valley createRadarArea(-2178, -599, 384, 275, 182, 186, 229, 255) -- Foster Valley createRadarArea(-2178, -1115, 384, 516, 101, 102, 231, 255) -- Foster Valley createRadarArea(-2178, -1250, 384, 135, 79, 99, 146, 255) -- Foster Valley createRadarArea(-1499, -50, 257, -199, 91, 188, 191, 255) -- Easter Bay Airport createRadarArea(-1982, 744, 111, -530, 188, 189, 36, 255) -- Downtown createRadarArea(-1871, 1176, 251, -98, 52, 70, 174, 255) -- Downtown createRadarArea(-1700, 744, 120, -432, 233, 94, 133, 255) -- Downtown createRadarArea(-1580, 744, 81, -281, 28, 232, 52, 255) -- Downtown createRadarArea(-2078, 578, 579, -166, 133, 167, 112, 255) -- Downtown createRadarArea(-1993, 265, 199, -313, 176, 24, 21, 255) -- Downtown In-game, it looks like that: Which is of course, bad. Some districts are nicely placed, but some not - it's probably because my calcuations does not work when coords starts/ends with other corner. So my question is, is there a way to determine which corner it starts/ends from map.zon/MTA source code? Or is there other way to implement this, better than trying to do it by hand? Maybe there is a script for that already? I couldn't find any, unfortunately. Thanks!
  19. Hardcore Action-RPG is an ambitious one-man project, and it's exactly what's its called - an RPG with heavy PvP elements and organic interactions between players for hardcore gamers, who are seeking exciting and stressful experience. If you want just to chill - it's totally not for you. The main goal is to design a deep, but user-friendly and consistent (in terms of simplicity) experience. The mod contains a narrative tutorial intro and UI is consistent to each other, it doesn't feel like 10 different people was trying to make something, it feels more like a standalone game than a mod. There will be a lot of screenshots and gifs - forgive me, but it's the best way to show you what's actually being created here, without writing whole essays. HARPG is set in San Fierro, but in Night City version (not visually, just atmosphere), where "sky high rate of violence, and more people living below the poverty line than anywhere else. Can’t deny it, it’s all true. But everybody still wants to live here". It's kept in 90's like "normal" GTA: SA. I'm a gamer myself and what the most important things I value in games is atmosphere and sound design - from what I've experienced in MTA, my mod is on a whole nother level in terms of building a climate, with carefully chosen high quality ambients/music and sound effects for many things, you won't experience freesound.org-like sounds there, everything is on near-AAA level. Despite the mod revolves around PvP elements - HARPG doesn't rely solely on shooting everyone on sight, in fact, it's quite opposite - you need to make conscious decisions, as murdering in cold blood is pretty well punished (more on that later), often it's better to just intimidate someone, or make them lose their consciousness, which is a seperate mechanic - it's not punished at all and you can still loot an unconscious person. But it's harder to execute than... just execute someone : D But what about combat itself? • Weapons has recoil • The camera is shaking while aiming (it's not drunk level) • Weapons has their condition, they can jam (the jamming rate based on condition) and you can install modifications, such as suppressors, stocks, scopes with or without NV/TV (for sniper rifle) and many others • Both shotguns, sawed-off and country rifle (here: Winchester) has normal reloading animation • Weapons does not appear magically in hands • Custom weapons, such as Taser • Pocker taser • Pepper spray • And grenades - Flashbang, Stun, Incendiary, or Smoke • Decals system - bullet holes and blood on the walls + altered sparks and cinematic smoke effects, to make the combat spectacular and satisfying • Various speed of reloading, also, guns reloads by magazines (like in Mafia 1 or mil-sims), rather than magically adding bullets to magazine, like in most games • Local injuries system - shooting in the leg has better chance to KO someone, but it's dealing less damage, similar with shooting an arm, but with a chance to disarm someone, and, for example, when an enemy is running or jumping, there's a much more chance to KO them • Death animations resembles more of the SP anims (even better, I must say), rather than boring and unsatisfying default MTA dying • Molotov coctail must be ignited before using + when someone is burned, their skin changes to burned one (death by explosion has also seperate skin texture) • Very high quality sound effects with animations sync, which makes combat actually fun • You can hold your breathe while aiming with a sniper rifle • Statuses show various things, like attack/killer/wanted status, medicaments/drugs effects and side effects • and many more interesting mechanics Probably most important gameplay mechanics, as they're responsible for making HARPG an unique and exciting experience. • System detecting who attacked first, if assisting, if killed in cold blood, if killed in self-defense • Anti-logout system, you won't be able to logout for 2 minutes if you aim for someone, or anyone aims at you, techically, you'll be, but your character will still stand there, helpless and ready to die and loot. • After killing someone in cold blood, you won't be able to logout for 15 minutes (you can kill in self-defense as many times as you'll have to defend yourself), after 2 more murders when your kill status is active (it's refreshing after every frag), you'll be marked on map and there will be bounty for your head, and, of course - you can't logout. Every further homicide increases your bounty and refreshes your logout status, so you'll need to survive for some time without killing anyone, even if self-defense. • Psyche system - killing in cold blood isn't easy for your character, if you get a PTSD, you'll experience hallucinations and panic attacks, in general, the game will be harder to play for you for some time. However, as you get more experienced in killing, the PTSD chance is getting lower. (there are many more effects, but I don't want to spoil them : D) • After death, you'll lose everything in your inventory, every penny you've gathered in your wallet, you won't be able to login into your account for 30 minutes and your dead body will by lying on some gutter until 30 minutes pass. But most importantly - you can die only 5 times. It's the end of the line after that, so you better be careful. Like I said before, my goal is to make a simple, yet deep and stressful experience for hardcore players, that's why crafting is also simple, with only 5 materials and easy-to-use UI. With all above combined, there is essential RPG mechanic - a character progression, there are 8 attributes (strength, endurance, agility, perception, proficiency, IT, chemicals, medicine) and many skills (they work more or less similar to single player). Attributes are developed naturally - by playing, for example, strength is raising when you take a damage, endurance when you drain stamina/oxygen, and proficiency when you craft/take apart items. You can also boost progression speed with drugs (which has a nice addiction system) and doing something in a particular weather conditions, for example - proficiency develops faster at night, and endurance develops faster when it's scorching outside. Some of the things that you can earn from leveling up: • Strength lessen a KO chance, increases HP, carry weight or let you use weapons • Endurance increases stamina, damage resistance, lessen the timespan of negative effects from taser or special grenades • Agility increases combat, climbing, running, getting up etc. animation speed, and lessen the chance of being disarmed • Perception increases range of seeing name tags, brighter the nights, or increases a chance to inflict bleeding status with ranged weapons • IT is under design right now, but it will be connected with your cellphone (yeah, not realistic, but it doesn't need to be : D) • Proficiency, chemicals and medicine are used mostly for crafting and materials, but they have some other benefits as well • Skills works roughly the same as in SP, with a few differences - weapon skills for example, impacts reloading speed, camera shake or recoil. Not much to say there. There's an automatic work mechanic (when you're offline), the more endurance attribute, the more you can work offline, but your main goals should be production of drugs, medicaments, weapons, controlling neighborhoods or businesses, cause honest work won't make you much. Or you can just practice "stabbing, strangling, bludgeoning, crushing, hacking, drowning, igniting" ; ) It's still far to go, but maybe after this post I'll know how many people are actually interested in something that experimental like this. I won't drop the production, cause I'm passionate about this project and it's almost 1,5 years of development already, but it's always nice to hear some feedback ; ) Some other screens, that didn't fit anywhere else: • Inventory • Tutorials • Settings • Controls scheme • Drop cash • Character creator • Dark nights There's no Discord for now, there's a Youtube channel though, but it's in Polish right now and mostly depracted stuff, I'll post some videos to you after I take a better care with that channel. Thank you if you read everything!
  20. It finally works! You don't know how many hours I've wasted on this XD Love ya! Thanks!
  21. I'm feeling much stupid right now, it works without converting normals to eulers, thanks a bunch! As for the TargetEnd - no need to, debugged it already and there seems to be no issues like that. Okay, so if I can use it like this in FX'es, what about functions that needs euler angles and/or use Vector3? I was playing with material3DEffects (https://community.multitheftauto.com/index.php?p=resources&s=details&id=13314), I tried to use that method: -- texture or renderTarget, worldPosition Vector3(), rotation Vector3(deg) , size Vector2(0-n,0-n) function CMat3DSoftBlend: create( texture, pos, rot, siz ) local cShader = { shader = DxShader( "fx/material3D_soft_blend.fx" ), texture = texture, color = tocolor(255, 255, 255, 255), texCoord = {Vector2(1, 1),Vector2(0, 0)}, position = pos, rotation = rot, size = siz, billboard = false, clip = 450, zEnable = true, zWriteEnable = false, flipVertex = false, fogEnable = true, cullMode = 1, depthAttenuation = 1.2, depthAttenuationPower = 1.5 } if cShader.shader then local scX, scY = guiGetScreenSize() cShader.shader:setValue( "sHalfPixel", 1/(scX * 2), 1/(scY * 2) ) -- pass position and ZXY rotation to recreate gWorld matrix cShader.shader:setValue( "sElementRotation", math.rad( rot.x ), math.rad( rot.y ), math.rad( rot.z )) cShader.shader:setValue( "sElementPosition", pos.x, pos.y, pos.z ) cShader.shader:setValue( "sElementSize", siz.x, siz.y ) cShader.shader:setValue( "sFlipTexture", false ) cShader.shader:setValue( "sFlipVertex", cShader.flipVertex ) cShader.shader:setValue( "sIsBillboard", cShader.billboard ) cShader.shader:setValue( "uvMul", cShader.texCoord[1].x, cShader.texCoord[1].y ) cShader.shader:setValue( "uvPos", cShader.texCoord[2].x, cShader.texCoord[2].y ) cShader.shader:setValue( "sFogEnable", cShader.fogEnable ) cShader.shader:setValue( "fZEnable", cShader.zEnable ) cShader.shader:setValue( "fZWriteEnable", cShader.zWriteEnable ) cShader.shader:setValue( "fCullMode", cShader.cullMode ) cShader.shader:setValue( "fDepthAttenuation", cShader.depthAttenuation ) cShader.shader:setValue( "fDepthAttenuationPower", cShader.depthAttenuationPower ) -- set texture cShader.shader:setValue( "sTexColor", cShader.texture ) self.__index = self setmetatable( cShader, self ) return cShader else return false end end It creates 2D texture in the 3D world, similar to dxDrawImage3D, but with much better customization and accuracy. But I can't get the right angles here too. Yeah, the angles are in ZXY order, the code is almost identical to the previous one, just using CMat3DSoftBlend constructor with Vector3(RotZ, RotX, RotY) on the rotations, instead of FX function. Unfortunately, not converting the normals doesn't work in that case, it doesn't work with objects rotation either. Do you know what should I do in cases like that with normals, that processLineOfSight returns? Or is there a better way to render specific-placed 2D texture (like for example - a 2D dot at the end of the laser, which rotation should be relative to the surface) in 3D world? Thanks!
  22. Hey, I'm struggling for hours with something, that should be easy enough, but my math skills are weak. So, I'm trying to find a right rotation for dirX, dirY, dirZ when you shoot something, wth any of the effects such as https://wiki.multitheftauto.com/wiki/FxAddSparks, but I can't get it at all. I'm using processLineOfSight to get a normal vectors, then I'm converting them to Euler angles with https://wiki.multitheftauto.com/wiki/Math.rotVecToEulerAngle, but the sparks are not flying right. The code is pretty simple (there were like 100 different attempts and approaches, but let me show you the most normal example XD): local Hit, TargetEndX, TargetEndY, TargetEndZ, _, NormalX, NormalY, NormalZ, Material = processLineOfSight(TargetX, TargetY, TargetZ, TargetEndX, TargetEndY, TargetEndZ, true, true, true, true, false, false, false, false, false, true, true) if(Hit == true) then local RotX, RotY, RotZ = math.rotVecToEular(NormalX, NormalY, NormalZ, 0.0) fxAddSparks(TargetEndX, TargetEndY, TargetEndZ, RotX, RotY, RotZ, 1.0, math.random(10), 0.0, 0.0, 0.0, true, 1.0, 1.0) end and yeah, I don't know what actually should I calculate there, can't even find any similar script to what I'm trying to do, which is rather surprising Can someone enlighten me? Please, use a very simple language when it comes to maths, cause I'm mathidiot. Thanks!
×
×
  • Create New...