Log in to reply
 

[SCRIPT] [RELEASED] - Ground Vehicle Effects



  • @Eddlm I probably will do when I get all the basic functionality working. I am having problems detecting when the wheels lock up though. If the game leaves tyre marks, then that's an event I need to sync with but there is no Vehicle.IsSkidding(), just Vehicle.IsInBurnout().

    I have had to put conditions round that because you could trigger the burnout at any speed as it seems to be a controller action, not a vehicle re-action. If you press the right controls, the game returns a true, even if you're doing 140mph down the freeway... which was a bit mad.



  • @LeeC2202 First of all this looks amazing. Secondly, I am really happy to see you back to the scripting, Since, IDK, but I hate the "Good-bye", so seeing you back in action, relives me a bit. (:

    Now, to your problem, you mentioned above, correct me if I am wrong. You are looking for tyre marks event(the one it leaves, on an in-game concrete roads and not on beach sand???)

    If this is what are you looking, I may not have an exact answer, but can this be achieved with below method?

    IDK, but making just a wild guess...

    How about using GET_VEHICLE_TYRE_SMOKE_COLOR as native to instantiate?

    As far as I know, in GTA V tyre leaves smoke and trails on 2 events(Burnout and Sudden Breaks)

    So, adding 2 conditions, First, getting the tyre smoke color(regardless what it is), if it returns != null then checking !vehicle.isinburnout()

    Also, I am adding @stillhere cause, he has worked alot on tyre and related in-game effect.



  • @LeeC2202 Okay....I tried to PM with you but it seems you've got it restricted
    here's the one in that screenshot,S-70A by skyline
    https://www.gta5-mods.com/vehicles/s-70a-firehawk-fire-fighting-helicopter



  • @LeeC2202 i think you can get the wheels' spinning speed in the latest scripthookvdotnet, could be useful.



  • @Eddlm I'm already using that and yes, it is useful. I use that to generate the launch speed of particles during the initial phase, when you are in a burnout. :slight_smile: Although I have found one car that generates a value of 0 for it, but I am not sure why. :\

    Edit: Just realised, I am still building against 2.9.4, so I wonder if that property has been in there for a while? I am using Vehicle.WheelSpeed, is that the property you mean, or is there even more now?

    @ashishcw No, I am looking for the point that the game registers that it is creating tyre marks as part of the physics process. I need to know when the car is in a skid, that is when the game creates the tyre marks. It doesn't create tyre smoke in a lateral skid... as far as I know.

    GET_VEHICLE_TYRE_SMOKE_COLOR is the partner to SET_VEHICLE_TYRE_SMOKE_COLOR, it returns or takes in respectively, an RGB value and is for checking or setting the smoke colour. It's a mod option, not a game event as such.



  • @LeeC2202 Love your helicopter/bus lights/dirty cars mod, and this looks absolutely amazing. I can't wait to leave massive clouds of smoke and thick black lines everywhere.
    I am so glad you haven't managed to stay away from here...It seems this site is easy to become addicted to ;) but know that I, for one, really appreciate all the hard work you and everyone else puts in to keeping GTA V alive and kicking!!



  • @Elope It's okay, when I find an answer, I will initiate a chat. I will download that addon and give it a try, thanks for the link.



  • @LeeC2202 thanks lee, yes that would be great



  • @LeeC2202 This is kind of "hacky" but maybe you can use a combination of WheelSpeed and Speed (of the vehicle):

    When vehicle.Speed is low and vehicle.WheelSpeed is high, typically there are skid marks being made, no? And vice versa, going very fast and then suddenly braking will cause skid marks. Of course you would have to find the perfect values for both Speed and WheelSpeed.



  • @stillhere The problem is when you go into a handbrake turn, or simply lose grip. At that point, wheel speed and vehicle speed are pretty much identical. I actually recorded a session last night to try and determine if either of those factors would indicate the process but they were inconclusive.

    Consider this image which shows the progress of a skid, notice the wheel and vehicle speeds during the whole process.

    What I need, are the calculations than monitor the forward and lateral velocities, because what does happen during a skid, is the lateral velocity increases, while the forward velocity decreases. At the end of the skid, the car is sliding sideways, but moving slightly backwards. But that's the type of maths I really do struggle with. :(

    0_1496166306187_skids.jpg



  • @LeeC2202 I see :( I hope you can figure it out, cause this mod will be awesome!

    Edit: perhaps this can help!



  • @LeeC2202 You really just can't stay away, can you? XD Anyway, can't wait to see how this turns out.


  • MODERATOR

    This post is deleted!

  • MODERATOR

    @LeeC2202 said in [SCRIPT] [WIP] - Ground Vehicle Effects (Working Title):

    1. I can't get rid of the default game-generated particles

    That's actually pretty easy and requires NOPing only one (well, if you want it to be 100% safe, two) function call(s). To specify, simply NOP 5 bytes at (4C 03 C8 F3 0F 11 4C 24 20 E8 ?? ?? ?? ?? 0F 28 74 24 60) + 9.



  • @ikt said in [SCRIPT] [WIP] - Ground Vehicle Effects (Working Title):

    Considering you only need to check if a wheel is locked up

    The problem is, that's not what defines a skid... which is probably my fault for saying I was trying to detect when a wheel locks up... sorry, it's confusing as heck and I don't help myself. :blush:

    A skid is where the centripetal force generates a higher force than the contact patch can generate friction to maintain grip, at which point, the wheel loses traction. It doesn't lock up, it slides sideways whilst maintaining the same speed... In that image I posted, all the way through that skid, the wheels are rotating the same speed but the car is moving sideways.

    This is unfortunately a physics/force issue, not a wheel issue... which is why I need to get the lateral forces/velocity figures to know what is happening. It's also why I am having so many problems because physics/force issues make my brain hurt. :(

    What that code will help with though (when I convert it to C#), is any other vehicles that aren't reporting any kind of wheel rotation speed at all... so it is still useful,.. so thank you.

    @Unknown-Modder Thanks, I can give that a try... I am not 100% convinced that it will look better without the default particles but without seeing it, I just can't tell... so at least with this I can make a proper judgement call.



  • Hmmm... so not much progress today, I had another task to attend to which was good because I was struggling with this problem. Having just had another check through the NativeDB documentation, I found some potentially useful natives.

        Vector3 GET_ENTITY_ROTATION_VELOCITY(Entity entity)
        float GET_ENTITY_SPEED(Entity entity)
        Vector3 GET_ENTITY_SPEED_VECTOR(Entity entity, BOOL relative)
        Vector3 GET_ENTITY_VELOCITY(Entity entity)
    

    I guess I need to remember to expand my research beyond just vehicles, I am clearly thinking too rigidly. So that's a few more values that I can monitor and maybe from them, I can get a better understanding of the whole vector/velocity thing.

    Edit: Quick update before I go... Speed Vector is the key to my problem. That gives me lateral motion, which I have been able to monitor for skid induction. I have also found a Vehicle.MaxTraction, which is the value the SpeedVector.X property must pass before, a slight skid is registered. Passing 8 seems to initiate the tyre marks at a faint level, ramping up to full on skidmarks around 15 - 16. I need to try some different cars to see if those values are absolute, or relative to MaxTraction.

    So that pretty much gives me the tools I need to do full state switching between normal driving, skidding and burnouts. So a slow day turned into a last minute sprint with positive results.


  • MODERATOR

    This post is deleted!


  • @ikt said in [SCRIPT] [WIP] - Ground Vehicle Effects (Working Title):

    I think you missed a most crucial thing from my edit

    No... I did notice that, it was the thing I was most aware of. I was just that tired by the time I was replying to things last night, I wasn't covering everything. I had got to the 6 hours sleep in 72 hours and was lagging big-style... sorry about that. :(

    All that code/info you are providing is really helpful and I cannot thank you enough for it. I'm pretty good at logic and understanding how things work and how to make things work but what you refer to as simple trig, is something my brain really struggles with. :blush:

    When I learn something, I have to break it down to something that I can relate to, but as trig (and most complex maths) relies on some fairly specific terminology, that's where my learning process falls over... I can't break that down into something more manageable. That probably makes no sense to someone who understands it and finds it easy to use.

    Anyway, again... a genuine thank you for all your help... and that goes to anyone that has offered help. Now I need breakfast after my massive 6 hours sleep and then I can get back to it. :slight_smile:



  • Today's progress so far = Zero. Today's attempts to implement the code I have been so generously given = Total Failure. The chances of me implementing the rest of the code <= Zero. :(

    I seem to be being controlled today by nagging issues unrelated to this mod... this might end up being one of those recycle bin days... not good, not good at all.


  • MODERATOR

    This post is deleted!


  • @ikt It looks straightforward and I've converted it to C# and it looks pretty much identical. So the only thing I can assume, is that I am not feeding it the right values.

    For instance, that understeer code looks like this in my code.

    double understeer = Math.Min(1.0f, Math.Abs(PlayerVehicle.SteeringAngle * Math.Sqrt(PlayerVehicle.Velocity.Y) - RotationVelocity.Z));
    

    Two of them are SHVDN results and the last one comes from:

    RotationVelocity = Function.Call<Vector3>(Hash.GET_ENTITY_ROTATION_VELOCITY, PlayerVehicle);
    

    But I don't know if Velocity.Y is correct, because in SHVDN, Vehicle.Velocity is a Vector3, which it didn't like using in a Math.Sqrt(). Velocity I am getting from:

    Function.Call<Vector3>(Hash.GET_ENTITY_VELOCITY, PlayerVehicle);
    

    The oversteer just seems to display NaN most of the time.

    So as you can imagine, if I am failing to get the simple bits of your code to work, the chances of me getting that wheel rotation code to work are not very high. I am actually wondering if I can use the RPM and gear ratios to provide values that will determine of the wheels would be spinning or not.

    This is where I struggle... I end up having to hack solutions together based on what I do know, because I don't understand what I need to know, to do it properly. Had that WheelSpeed property done what I thought it was doing, I would have been fine...



  • Beware, as SteeringAngle is something pulled from memory and will not work properly if SHVDN isn't updated with the latest offsets. Learned it the hard way, my Street Races' AI helper breaks entirely every update because of this.



  • @Eddlm Thanks for the heads up on that... I was digging through the SHVDN source today looking at vehicles and noticed a couple of things pulling memory offsets. It didn't register that was one of them.



  • @LeeC2202 The hero we need.



  • @LeeC2202 I just watched your prototype video and would you mind to tell how you did those vertical helplines (code snippet maybe) please ? All those debug information is worth to be called a debug mod already. :)


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.