Topic category: Help with Minecraft modding (Java Edition)
Hi everyone!
Firstly I just want to say that I am no expert in minecraft modding and I just starded to play with MCreator about a week ago. So any help and tips would mean a world to me :)
I'm currently working on a mod (GeckoLib + Forge 1.20.1) that features various types of vehicles. Right now, I have a good vehicle model along with animations for driving forward, backward, and turning left and right. However, I’d like the driving mechanics to go beyond simply holding "W" or "S" for forward and backward movement while turning with the mouse.
What I’m aiming for is to have more realistic controls where the player can freely move the camera around the vehicle and use "WASD" keys for steering. Ideally, the wheels and vehicle would respond naturally to directional inputs.
Additionally, I’m looking for tips on how to implement realistic weight and gravity for the vehicle, so it can respond to the environment more dynamically instead of always staying perfectly level with the ground. Because currently, i am not able to go up the blocks unless i have strafe movement control enabled in my entity config.
Any advice or insights on how to achieve this would be greatly appreciated!
To make it turn naturally When you press a or s you will make a producer that will make the vehicle turn 3degrees every tick
Create a keybind and then in the when pressed have it turn 3 degrees. You would have to spam the button unless you had it trigger a global variable in a procedure called each tick and then had it change back to false if you press it again.
There is a On Key Pressed & On Key Released Procedures you do know? Meaning you can just create a Variable called "APressed" or "DPressed" And when A is pressed for example; make the "APressed" Variable True and when released make it false. Then in any Tick update procedure you have for this, Just make a check to see if one or the other value is true, Then make it turn in the Direction (Using advice above) in relation to the key you pressed. Then ElseIf None of those are being pressed, Then move forward only. Hope this kinda helps,
Oh and forgot to mention you do need Keybind elements for your buttons if you don't already, in the Keybind you will find onPressed or onReleased ^
But how do you make a custom entity move forward relative to the custom entity looking at??
Save the player's look angle as a global variable