Moony Posted March 29, 2020 Share Posted March 29, 2020 I've been working on a script that realistically manipulates the wheels. I've gotten to the point I can hide the original wheels, in hopes I can later attach a new set in the same place. I'm aware I might have to use attachElements, and several other functions. For the moment, I'd like to attach a single wheel. I've got this: -- All GUI elements. local vehicle = getPedOccupiedVehicle(localPlayer) local x1, y1, z1 = getVehicleComponentPosition(vehicle, "wheel_lf_dummy") local x2, y2, z2 = getVehicleComponentPosition(vehicle, "wheel_rf_dummy") local x3, y3, z3 = getVehicleComponentPosition(vehicle, "wheel_lb_dummy") local x4, y4, z4 = getVehicleComponentPosition(vehicle, "wheel_rb_dummy") local function replace1 () attachElements (1097, vehicle, x1, y2, z1, 0, 0, 0) end addEventHandler ("onClientGUIClick", set1, replace1, false) -- Function runs when button called 'set1' is clicked. -- Everything else. Here's my thought process: First, I get the player's vehicle. Then, I get the position of all four wheels in the player's vehicle, and represent them with x1, y1 and z1. With all wheels hidden by another function, I then attach the wheel model in the same place as the front left wheel. At the moment, I'm only aiming at the position; I'll handle the rotation later. DB 3 can't identify '1097', and thus asks for a valid element. Am I on the right path? Link to comment
Scripting Moderators ds1-e Posted March 30, 2020 Scripting Moderators Share Posted March 30, 2020 9 hours ago, Moony said: I've been working on a script that realistically manipulates the wheels. I've gotten to the point I can hide the original wheels, in hopes I can later attach a new set in the same place. I'm aware I might have to use attachElements, and several other functions. For the moment, I'd like to attach a single wheel. I've got this: -- All GUI elements. local vehicle = getPedOccupiedVehicle(localPlayer) local x1, y1, z1 = getVehicleComponentPosition(vehicle, "wheel_lf_dummy") local x2, y2, z2 = getVehicleComponentPosition(vehicle, "wheel_rf_dummy") local x3, y3, z3 = getVehicleComponentPosition(vehicle, "wheel_lb_dummy") local x4, y4, z4 = getVehicleComponentPosition(vehicle, "wheel_rb_dummy") local function replace1 () attachElements (1097, vehicle, x1, y2, z1, 0, 0, 0) end addEventHandler ("onClientGUIClick", set1, replace1, false) -- Function runs when button called 'set1' is clicked. -- Everything else. Here's my thought process: First, I get the player's vehicle. Then, I get the position of all four wheels in the player's vehicle, and represent them with x1, y1 and z1. With all wheels hidden by another function, I then attach the wheel model in the same place as the front left wheel. At the moment, I'm only aiming at the position; I'll handle the rotation later. DB 3 can't identify '1097', and thus asks for a valid element. Am I on the right path? attachElements expect object. Create object with model 1097, save it to variable, and then pass it as 1st argument. Link to comment
Moony Posted March 30, 2020 Author Share Posted March 30, 2020 Alrighty! Big progress has been made. Would you mind helping me a bit more? I've managed to set all 4 wheels in the appropiate place and apply a function to them to set the size. IMAGE I'd like to know if there is a way to keep the wheels grounded; they are anchored to the center. Is there a function that can help me in such way? Also, as soon as the scrollbar is moved, the wheels begin from practically a zero size, and scale 100 points (scroll value was divided by 100). Would it be possible to set the lowest limit? Here's the function that handles the size: -- Parent function that creates everything fdiam = guiCreateScrollBar(0.09, 0.66, 0.752, 0.06, true, true, wheelWnd) local function setScaleFront() local vehicle = getPedOccupiedVehicle(localPlayer) local valueFront = guiScrollBarGetScrollPosition(fdiam) local size = getObjectScale (wheel1) setObjectScale (wheel1, valueFront/100, valueFront/100, valueFront/100) setObjectScale (wheel2, valueFront/100, valueFront/100, valueFront/100) -- local position1 = getElementPosition (wheel1) -- local position2 = getElementPosition (wheel2) -- setElementPosition (wheel1, 0, 0, valueFront+0.01) -- setElementPosition (wheel2, 0, 0, valueFront+0.01) -- Failed attempt to set a dynamic position that increases -- 0.01 the position. end addEventHandler("onClientGUIScroll", fdiam, setScaleFront, false) -- Everything else. Link to comment
Moony Posted April 2, 2020 Author Share Posted April 2, 2020 UPDATE: I've managed to set a minimum size to the wheels. However, I'm still having trouble getting the wheels to stay at ground level. Additionally, are there any functions to apply the rotation and steering visuals of the original wheels to the attached objects? Link to comment
_Ace Posted April 2, 2020 Share Posted April 2, 2020 (edited) you need the wheels at ground level while moving the scrollbar? you can change the attachelements z offset, then you will need to calc the distance from the center off the wheel (the attached one) using https://wiki.multitheftauto.com/wiki/GetGroundPosition and https://wiki.multitheftauto.com/wiki/GetElementDistanceFromCentreOfMassToBaseOfModel Im not sure if this will work with resized object, but if not, you can https://wiki.multitheftauto.com/wiki/GetObjectScale to do the math, about the wheel rotations you can use: https://wiki.multitheftauto.com/wiki/GetVehicleComponentRotation and setElementRotation Edited April 2, 2020 by _Ace 1 Link to comment
Moony Posted April 2, 2020 Author Share Posted April 2, 2020 52 minutes ago, _Ace said: about the wheel rotations you can use: https://wiki.multitheftauto.com/wiki/GetVehicleComponentRotation and setElementRotation I'm pretty sure I'm not getting the functions. Spoiler local function replace1 () -- Function that applies the set of wheels number 1. local vehicle = getPedOccupiedVehicle(localPlayer) local x1, y1, z1 = getVehicleComponentPosition(vehicle, "wheel_lf_dummy") local x2, y2, z2 = getVehicleComponentPosition(vehicle, "wheel_rf_dummy") local x3, y3, z3 = getVehicleComponentPosition(vehicle, "wheel_lb_dummy") local x4, y4, z4 = getVehicleComponentPosition(vehicle, "wheel_rb_dummy") local rx1, ry1, rz1 = getVehicleComponentRotation (vehicle, "wheel_lf_dummy") local rx2, ry2, rz2 = getVehicleComponentRotation (vehicle, "wheel_rf_dummy") local rx3, ry3, rz3 = getVehicleComponentRotation (vehicle, "wheel_lb_dummy") local rx4, ry4, rz4 = getVehicleComponentRotation (vehicle, "wheel_rb_dummy") wheel1 = createObject (1097, x1, y1, z1, rx1, ry1, rz1) wheel2 = createObject (1097, x2, y2, z2, rx2, ry2, rz2) wheel3 = createObject (1097, x3, y3, z3, rx3, ry3, rz3) wheel4 = createObject (1097, x4, y4, z4, rx4, ry4, rz4) setElementRotation (wheel1, rx1, ry1, rz1) setElementRotation (wheel2, rx2, ry2, rz2) setElementRotation (wheel3, rx3, ry3, rz3) setElementRotation (wheel4, rx4, ry4, rz4) attachElements (wheel1, vehicle, x1, y1, z1+0.01, rx1, ry1, rz1) setObjectScale (wheel1, 0.66, 0.45, 0.45) attachElements (wheel2, vehicle, x2, y2, z2+0.01, rx2, ry2, rz2) setObjectScale (wheel2, 0.66, 0.45, 0.45) attachElements (wheel3, vehicle, x3, y3, z3+0.01, rx3, ry3, rz3) setObjectScale (wheel3, 0.66, 0.45, 0.45) attachElements (wheel4, vehicle, x4, y4, z4+0.01, rx4, ry4, rz4) setObjectScale (wheel4, 0.66, 0.45, 0.45) end addEventHandler ("onClientGUIClick", set1, replace1, false) Nothing happens. Wheels are still static. 1 hour ago, _Ace said: you need the wheels at ground level while moving the scrollbar? you can change the attachelements z offset, then you will need to calc the distance from the center off the wheel (the attached one) using https://wiki.multitheftauto.com/wiki/GetGroundPosition and https://wiki.multitheftauto.com/wiki/GetElementDistanceFromCentreOfMassToBaseOfModel Im not sure if this will work with resized object I don't get how they both work, and how they have to be used to give the desired effect. I tried: local vehicle = getPedOccupiedVehicle(localPlayer) local x1, y1, z1 = getVehicleComponentPosition(vehicle, "wheel_lf_dummy") local a1, b1, c1 = getGroundPosition (x1, y1, z1) wheel1 = createObject (1097, a1, b1, c1, rx1, ry1, rz1) attachElements (wheel1, vehicle, a1, b1, c1, rx1, ry1, rz1) DB 3 returns "attempt to call global 'getGroundPosition' (a nil value) My thought process was (while hardly understand how the functions work): Get the ground position of the coordinates of the left front wheel of the vehicle being driven by the local player. Apply that position to the creation of the object and the attachment of the element. Link to comment
_Ace Posted April 3, 2020 Share Posted April 3, 2020 I tested with: attachElements(wheel,getPedOccupiedVehicle(localPlayer),wheelx,wheely,whellz+getElementDistanceFromCentreOfMassToBaseOfModel(whell)*getObjectScale(whell)-getElementDistanceFromCentreOfMassToBaseOfModel(whell)) which means: position z of attached wheel + half the radius of the wheel multiplied by wheel scale + half the radius of the wheel the object wheel stayed in ground while resizing with the scrollbar, I will do some more testing regarding the rotations and soon I send you the example code 1 Link to comment
_Ace Posted April 3, 2020 Share Posted April 3, 2020 I made a video to show how its working, Im not sure if is the same effect you trying to do the part the changes the position while resizing is something like: addEventHandler("onClientGUIScroll", root, function(element) setObjectScale(roda,guiScrollBarGetScrollPosition(element)/10) attachElements(roda,getPedOccupiedVehicle(localPlayer),rodax,roday,rodaz+getElementDistanceFromCentreOfMassToBaseOfModel(roda)*getObjectScale(roda)-getElementDistanceFromCentreOfMassToBaseOfModel(roda)) end) with roda being the wheel object and rodax,roday,rodaz the attachelements offsets, to make the wheel object rotate with the real wheel I made a onclienprerender event getting the car z rotation and the wheel rotations: function rodarot() local vrotx,vroty,vrotz=getElementRotation(getPedOccupiedVehicle(localPlayer)) local rodarx,rodary,rodarz=getVehicleComponentRotation(getPedOccupiedVehicle(localPlayer),"wheel_rf_dummy") setElementRotation(roda,rodarx,rodary,rodarz+vrotz) end this code is not optimized nor checking for warnings/errors, just an example for use in a proper code 1 1 Link to comment
Moony Posted April 4, 2020 Author Share Posted April 4, 2020 I've managed to: - Set the wheels at ground level at all times when resizing. - Set the rotation to follow the dummies' rotation (including the steering). - Add an extra resize width scrollbar. After reading a few posts, I fell victim of the same strange effect mentioned in them: if the cars have either the McPhearson suspension or the Reverse suspension applied, or the wheels change their Y rotation for any reason, a strange wobble effect appears on the wheels-object. Apparently, the wheels-object, as it constantly grabs the position of the wheels-dummy, when these change their Y rotation, the wheels-object do so too, but this Y rotation axe spins as well, giving the effect of a severely uncentered wheel. Is there any way to fix this? I read something about locking the Y and X rotation... Additionally, I've noticed that when changing the cars inclination, the wheels do not get this inclination. Instead, they stay perpendicular to the ground: [IMAGE] Also, there is no suspension on the wheels-object. Could this be fixed with an "onClientPreRender" applied to a function that gets the position of the dummies and then setting said position to the objects? Finally, and out of context, how can I stop the script from running when there are no custom wheels applied? DB 3 goes nuts because it is not finding any wheels to apply all these functions. This also applies to a button that removes the wheels: there is no wheel to remove, so the script throws a warning. Thanks for all the help so far! I can't think you enough. Link to comment
_Ace Posted April 4, 2020 Share Posted April 4, 2020 I didnt see the angle problem before, I tested here and got the same wheel angle problem in the image you sent, the fix is simple: instead of using setelementrotation in the onclientprerender, use the last tree arguments in attachelements (the angle ones): attachElements(roda,getPedOccupiedVehicle(localPlayer),rodax,roday,rodaz+getElementDistanceFromCentreOfMassToBaseOfModel(roda)*getObjectScale(roda)-getElementDistanceFromCentreOfMassToBaseOfModel(roda),rodarx,rodary,rodarz) so I removed the setelementrotation and set the attachelements above to handle rotations, works nice at any angle plus seems to remove the wobbling, about the suspension I will do some more testing, and to remove the db3 warning you can set a command with a global flag to check if the code should proceed or halt, use if to check if the flag is true or false, if false use return, something like: if not wheelmanipulation then return end 1 Link to comment
Moony Posted April 5, 2020 Author Share Posted April 5, 2020 (edited) 48 minutes ago, _Ace said: I didnt see the angle problem before, I tested here and got the same wheel angle problem in the image you sent, the fix is simple: instead of using setelementrotation in the onclientprerender, use the last tree arguments in attachelements (the angle ones): attachElements(roda,getPedOccupiedVehicle(localPlayer),rodax,roday,rodaz+getElementDistanceFromCentreOfMassToBaseOfModel(roda)*getObjectScale(roda)-getElementDistanceFromCentreOfMassToBaseOfModel(roda),rodarx,rodary,rodarz) so I removed the setelementrotation and set the attachelements above to handle rotations, works nice at any angle plus seems to remove the wobbling, about the suspension I will do some more testing, and to remove the db3 warning you can set a command with a global flag to check if the code should proceed or halt, use if to check if the flag is true or false, if false use return, something like: if not wheelmanipulation then return end Thought I could try a few things. Now that I know about 'onClientPreRender', I tried adding the suspension effect. You can do it the same way you used the handler for the rotation. I used your same format and 'getElementPosition' and 'attachElements' to set the position. It's hard to notice, but the front wheel is pressing up, while the rear wheel is almost hanging. [IMAGE]. Those are the custom wheels. If I only press the button to apply the set of wheels, they will show the noinclination mistake. Strangely, if I scroll the bar, they will light-speed move between a normal state and the no-inclination state. As if the commands were happing both everytime the scroll moves one point. I've managed to get a single frame by spamming the F12 to get the screenshot: [IMAGE] That screenshot also shows that the scrollbar updates not only the inclination, but the position as well. The scrolling also calls for the ground level. As soon as I lift the mouse off the bar, the wheels lose the ground effect and starts floating. I'll try to fix how the size effect works on the wheels and the angle/wobble with your last comment. Do you want me to show you the script? ---- ---- ---- ---- UPDATE: I tried your last suggestion, and it worked perfectly. I had to remove the "+rotz" to get rid of the vehicle's rotation adding to the wheels rotation. It all works perfectly UPDATE_2: keep ground level while resizing has stop working. Now there is a glitchy wheel that starts off from the center of the car and explodes off and get bigger as I increase the value of the scrollbar. As for the wheels, they glitchily increase size while staying anchored to their center. Edited April 5, 2020 by Moony Research Link to comment
_Ace Posted April 5, 2020 Share Posted April 5, 2020 send your code, maybe the glitch is related to the scrollbar, I did some testing and the suspension effect is posible with setting a variable (z of https://wiki.multitheftauto.com/wiki/GetVehicleComponentPosition) to the attachelements Z offset instead of fixed number, for now it is required to adjust Z+- if trying with other car, but testing with one car the object wheel looks like a real one managed from gta, no bugs resizing or while driving 1 Link to comment
Moony Posted April 5, 2020 Author Share Posted April 5, 2020 (edited) 15 hours ago, _Ace said: send your code, maybe the glitch is related to the scrollbar Here's the function that used to handle the diameter of the wheels, one for both front wheels, and one for the rear wheels: fdiam = guiCreateScrollBar (0.09, 0.66, 0.375, 0.06, true, true, wheelWnd) local function setScaleFront () local vehicle = getPedOccupiedVehicle (localPlayer) local valueFront = guiScrollBarGetScrollPosition (fdiam) local sx1, sy1, sz1 = getObjectScale (wheel1) local sx2, sy2, sz2 = getObjectScale (wheel2) local px1, py1, pz1 = getVehicleComponentPosition (vehicle, "wheel_lf_dummy") local px2, py2, pz2 = getVehicleComponentPosition (vehicle, "wheel_rf_dummy") -- setObjectScale (wheel1, valueFront/100+0.5) -- setObjectScale (wheel2, valueFront/100+0.5) -- attachElements (wheel1, vehicle, px1, py1, pz1+getElementDistanceFromCentreOfMassToBaseOfModel(wheel1)*getObjectScale(wheel1)-getElementDistanceFromCentreOfMassToBaseOfModel(wheel1)) -- attachElements (wheel2, vehicle, px2, py2, pz2+getElementDistanceFromCentreOfMassToBaseOfModel(wheel2)*getObjectScale(wheel2)-getElementDistanceFromCentreOfMassToBaseOfModel(wheel2)) -- setObjectScale (wheel1, valueFront/100, valueFront/100, valueFront/100) -- setObjectScale (wheel2, valueFront/100, valueFront/100, valueFront/100) -- local position1 = getElementPosition (wheel1) -- local position2 = getElementPosition (wheel2) -- setElementPosition (wheel1, 0, 0, valueFront+0.01) -- setElementPosition (wheel2, 0, 0, valueFront+0.01) end addEventHandler("onClientGUIScroll", fdiam, setScaleFront, false) RESULT ** I've disabled everything. I tried to find the error but couldn't. The front train is the one available right now. I've disabled the rear train. As the bar is scrolled, the wheel jumps in a glitchy manner following an imaginary line that goes from the center of the car to the right top front corner. For every pixel that the bar is moved, the wheel jumps into this imaginary line and then returns to its ideal position. I think I know what the problem is. 'onClientPreRender' is constantly updating the position of the wheels. The wheel is kept on the ground only when the scrollbar is moved because the function is triggered by said event. When the bar is static again, the wheels' position is then updated again by the 'onClientPreRender'. In other words, I've got two 'attachElements' that are bumping eachother trying to fit in a very narrow door. Edited April 5, 2020 by Moony Link to comment
Moony Posted April 5, 2020 Author Share Posted April 5, 2020 (edited) I apologize for the multiple posts; everytime I finish posting, I dare myself to test some more... As of this moment, the following function lets my set the diameter of the wheels. However, the wheels are pivoting from their center; if the size is small enough, they float; if they are big enough, they clip through the ground. fdiam = guiCreateScrollBar (0.09, 0.66, 0.375, 0.06, true, true, wheelWnd) local function setScaleFront () local vehicle = getPedOccupiedVehicle(localPlayer) if not vehicle then return end local fdim = guiScrollBarGetScrollPosition(fdiam) local fx1, fy1, fz1 = getObjectScale (wheel1) local fx2, fy2, fz2 = getObjectScale (wheel2) setObjectScale (wheel1, fx1, fdim/100+0.5, fdim/100+0.5) setObjectScale (wheel2, fx2, fdim/100+0.5, fdim/100+0.5) local x1, y1, z1 = getElementPosition (wheel1) -- attachElements(wheel1, vehicle, x1, y1, z1+2+getElementDistanceFromCentreOfMassToBaseOfModel(wheel1)*getObjectScale(wheel1)-getElementDistanceFromCentreOfMassToBaseOfModel(wheel1), 0, 0, 180) -- [Notice the above function disabled] end addEventHandler("onClientGUIScroll", fdiam, setScaleFront, false) Everything else works correctly: rotation, suspension, width and position relative to the center of the wheel dummy. Edited April 5, 2020 by Moony Link to comment
_Ace Posted April 5, 2020 Share Posted April 5, 2020 (edited) you need to set 2 lines handling the attachments of wheels (attachelements) and they should be the same (the params), or this wheel jumping effect will happen, because the onclientprerender is fighting with the scrollbar event, so you can try setting the wheel size in a separate function from the onclientprerender, also check if your gui function is not recreating the wheel or reseting some variables, the way i did: the function that opens the gui create the wheel and attach to the car using offsets by getelementcomponentposition, and start the function with the onclientprerender, this is done once if I open the gui again, I have a if with return to prevent double execution, its looking like this: edit: I will try setting the 4 wheels to check if any bugs with the scrollbar Edited April 5, 2020 by _Ace 1 Link to comment
Moony Posted April 5, 2020 Author Share Posted April 5, 2020 (edited) 1 hour ago, _Ace said: you need to set 2 lines handling the attachments of wheels (attachelements) and they should be the same (the params), or this wheel jumping effect will happen, because the onclientprerender is fighting with the scrollbar event, so you can try setting the wheel size in a separate function from the onclientprerender, also check if your gui function is not recreating the wheel or reseting some variables, the way i did: the function that opens the gui create the wheel and attach to the car using offsets by getelementcomponentposition, and start the function with the onclientprerender, this is done once if I open the gui again, I have a if with return to prevent double execution, its looking like this: [VIDEO] edit: I will try setting the 4 wheels to check if any bugs with the scrollbar I've placed everything but the resizing in the 'onClientPreRender'. The resizing has the "stick to ground" function as well as the 'setObjectScale' only modifying the two necessary values. This is on a separate 'onClientGUIScroll'. I'm playing around with the functions, but I can't figure it out. I either get the glitchy will that is still anchored to the center, or no wheel at all. Sometimes the wheel flashes as it is rescaled, sometimes it looks clear. What's certain is that I can't find the correct setting to keep the wheels grounded. I've made sure there are no new instances of the wheels. I've placed the "stick to ground" function inside the 'onClientPreRender' function so it always updates the Z value. The scrollbar only modifies the scale of the wheel. [IMAGE] Edited April 5, 2020 by Moony Link to comment
_Ace Posted April 5, 2020 Share Posted April 5, 2020 yes thats correct, the onclientprerender will only do the positioning and rotation, and the onClientGUIScrollon function will only do the resizing, I dont get why you are getting those bugs since my function appears to be the same as yours, also I tested with 4 wheels no problem, just add the 4 objects and each one has its positions and attachelements, my function looks like this: command function = [create gui and hide normal car wheels; done once=(create 4 wheels objects and scale then to 0.7 just to first visual effect; start the onclienprerender function) ] onclientguiscroll function = [scale each wheel using the scroll position / 100] onclientprerender function = [ getVehicleComponentRotation for each wheel; getVehicleComponentPosition for each wheel; attachelements for each wheel ] maybe your onclientprerender function is auto incrementing some global variable, pls send your onclientprerender function 1 Link to comment
Moony Posted April 5, 2020 Author Share Posted April 5, 2020 2 minutes ago, _Ace said: maybe your onclientprerender function is auto incrementing some global variable, pls send your onclientprerender function Here it is: function wheel1Move() local px1, py1, pz1 = getVehicleComponentPosition(vehicle, "wheel_lf_dummy") local vehicle = getPedOccupiedVehicle (localPlayer) if not vehicle then return end -- Gets ride of a couple of DB 3 errors. local wrx1, wry1, wrz1 = getVehicleComponentRotation (vehicle, "wheel_lf_dummy") attachElements (wheel1, vehicle, px1, py1, pz1, wrx1, wry1, wrz1) -- attachElements(wheel1, vehicle, px1, py1, pz1+getElementDistanceFromCentreOfMassToBaseOfModel(wheel1)*getObjectScale(wheel1)-getElementDistanceFromCentreOfMassToBaseOfModel(wheel1), wrx1, wry1, wrz1) -- Alternating between both 'attachElements' gives the same result show in the picture. end addEventHandler ("onClientPreRender", getRootElement(), wheel1Move) [IMAGE] * Ignore the excessive brightness. That's another issue I'll have to resolve. Link to comment
_Ace Posted April 5, 2020 Share Posted April 5, 2020 (edited) so everything works but wheen resizing the bug appears? I see you alternated between the normal attachelements and the one with calculations with same results, this shouldn't happen maybe its the wheel size different then mine, try this line inside the onclientprerender function: attachElements(wheel1, vehicle, px1, py1, pz1+getElementDistanceFromCentreOfMassToBaseOfModel(wheel1)*getObjectScale(wheel1)-getElementDistanceFromCentreOfMassToBaseOfModel(wheel1)*0.70, wrx1, wry1, wrz1) this 0.70 is a offset increment to adjust the wheel Z, you change this value a bit more or less to check if it helps, the thing is using this line, the center of the whell should go up or down depending on the scroll and not stay in the same height, if its not happening check db3 if something is returning null btw, if you need I can send my full code to check if something helps, you can still do yours for the features you are adding like the wheel thickness etc Edited April 5, 2020 by _Ace 1 Link to comment
Moony Posted April 5, 2020 Author Share Posted April 5, 2020 31 minutes ago, _Ace said: so everything works but wheen resizing the bug appears? I see you alternated between the normal attachelements and the one with calculations with same results, this shouldn't happen maybe its the wheel size different then mine, try this line inside the onclientprerender function: attachElements(wheel1, vehicle, px1, py1, pz1+getElementDistanceFromCentreOfMassToBaseOfModel(wheel1)*getObjectScale(wheel1)-getElementDistanceFromCentreOfMassToBaseOfModel(wheel1)*0.70, wrx1, wry1, wrz1) this 0.70 is a offset increment to adjust the wheel Z, you change this value a bit more or less to check if it helps, the thing is using this line, the center of the whell should go up or down depending on the scroll and not stay in the same height, if its not happening check db3 if something is returning null I apologize for the format. I hope you can see the video correctly. The only thing that changed with the line provided (and also happened with the previous line) is that the width modifier now is modifying the height as seen in the video. I'm certain this is happening because there are values being read when they shouldn't. I'll try to fix that in the meantime. Regardless, they wheels are still not on ground level. I'll mess around with the values to see if I find anything weird. Link to comment
_Ace Posted April 5, 2020 Share Posted April 5, 2020 I think the problem maybe the scroll identified by the event is firing without the calculations, anyway let me know when you solve the problem 1 Link to comment
Moony Posted April 9, 2020 Author Share Posted April 9, 2020 After a lot of work and several tests, we managed to fix it. Case dismissed. 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