DigitalHax Posted August 24, 2012 Share Posted August 24, 2012 Hello all, I am having a go at vehicles again, and unfortunately I lost my old project files, so I am starting from scratch, yet one thing in blocking me. When i press A or D to turn the wheels left or right, they stay there and I am having trouble getting a working way of making them turn back. I have looked at the driver.lua file, and that's what I am basing it off, yet it does not seem to work. Here is my code. // Steering if (KeyDown(KEY_A) && (steerangle<=40.0f)) { steerangle+=0.7f; SetSteerAngle(veh, steerangle, 0); SetSteerAngle(veh, steerangle, 1); } else { if(!KeyDown(KEY_A) && (steerangle>0)){ if(steerangle>0){ steerangle=steerangle-4.0*AppSpeed(); } } } if (KeyDown(KEY_D) && (steerangle>=-40.0f)) { steerangle-=1.0f; SetSteerAngle(veh, steerangle, 0); SetSteerAngle(veh, steerangle, 1); } else { if(steerangle<0){ steerangle=steerangle+4.0*AppSpeed(); } } I had done this once before, but forgot. Can anyone give me some pointers to get this working? Thanks in advance, Quote Win7 64bit, Leadwerks SDK 2.5, Visual Studio 2012, 3DWS, 3ds Max, Photoshop CS5. Life is too short to remove USB safely. Link to comment Share on other sites More sharing options...
diedir Posted August 25, 2012 Share Posted August 25, 2012 Hi ithink you miss some lines i did : steerangle=Clamp(steerangle,-25,25) --25 here max angle car:SetSteerAngle(steerangle,0) car:SetSteerAngle(steerangle,1) hopeit was what you look for Quote AMD Ryzen 5900HX - Nvidia RTX 3070 - 32 Go - 1To SSD - W11 Link to comment Share on other sites More sharing options...
DigitalHax Posted August 26, 2012 Author Share Posted August 26, 2012 Thanks! That worked like a charm I must have missed needing to update the wheels to the angles. Thanks again Quote Win7 64bit, Leadwerks SDK 2.5, Visual Studio 2012, 3DWS, 3ds Max, Photoshop CS5. Life is too short to remove USB safely. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.